Giter VIP home page Giter VIP logo

green-app's Introduction

green-app

Features

Table of Contents

Background

GreenApp's goal is to promote a more sustainable lifestyle through friendly competition with yourself and others.

Quick Start

First, install docker-compose if you don't already have it:

docker-compose installation official docs.

Then change into your project directory and run:

chmod +x scripts/build.sh
./scripts/build.sh

This will build and run the docker containers, run the alembic migrations, and load the initial data (a user, activities and challenges).

Credentials for the user | email: [email protected] password: password

It may take a while to build the first time it's run since it needs to fetch all the docker images.

Once you've built the images once, you can simply use regular docker-compose commands to manage your development environment, for example to start your containers:

docker-compose up -d

Once this finishes you can navigate to the port localhost:8000, and you should see our application:

Note: If you see an Nginx error at first with a 502: Bad Gateway page, you may have to wait for webpack to build the development server (the nginx container builds much more quickly).

The backend docs will be at http://localhost:8000/api/docs.

Rebuilding containers:

docker-compose build

Restarting containers:

docker-compose restart

Bringing containers down:

docker-compose down

Admin Dashboard

This project uses react-admin for a admin dashboard displaying all users.

After starting the project, navigate to http://localhost:8000/admin. You should see a login screen. Use the username/password for the default user mentioned above.

Migrations

Migrations are run using alembic. To run all migrations:

docker-compose run --rm backend alembic upgrade head

To create a new migration:

alembic revision -m "create users table"

And fill in upgrade and downgrade methods. For more information see Alembic's official documentation.

Logging

docker-compose logs

Or for a specific service:

docker-compose logs -f name_of_service # frontend|backend|db

Project Layout

backend
└── app
    ├── alembic
    │   └── versions # where migrations are located
    ├── api
    │   └── routers # contains all the endpoints for each table in the database.
    ├── core    # config
    ├── db      # db models, schemas and crud
    ├── tests   # pytest
    └── main.py # entrypoint to backend

frontend
└── public
└── src
    ├── admin # for admin dashboard
    │ 
    ├── components # components that are not pages
    │   └── ActivityChart.tsx
    ├── config
    │   └── index.tsx   # constants
    ├── forms # form components
    │ 
    ├── interfaces # component interfaces
    │ 
    ├── pages # page components
    │   └── HomePage.tsx
    ├── state # context state management
    │   └── activities
    │   │   └── activitiesActions.ts
    │   └── challenge
    │   └── performsActivities
    │  
    ├── __tests__ # frontend tests
    │   └── test_home.tsx
    ├── styledComponents # components styled with styled-components
    │   └── StAppBar.tsx
        ├── pages # page components
    │   └── HomePage.tsx
    ├── index.tsx   # entrypoint
    └── App.tsx     # handles routing

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.