- FastAPI with Python 3.8
- React 16 with Typescript, Redux, and react-router
- Postgres
- SqlAlchemy with Alembic for migrations
- Pytest for backend tests
- Cypress for frontend tests
- Perttier/Eslint (with Airbnb style guide)
- Docker compose for easier development
- Nginx as a reverse proxy to allow backend and frontend on the same port
The only dependencies for this project should be docker and docker-compose.
Starting the project with hot-reloading enabled (the first time it will take a while):
docker-compose up -d
To run the alembic migrations (for the users table):
docker-compose run --rm backend alembic upgrade head
And navigate to http://localhost:8000
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).
Auto-generated docs will be at http://localhost:8000/api/docs
docker-compose build
docker-compose restart
docker-compose down
I decided to decouple the frontend from the docker-compose containers so for frontend development you need to
cd frontend
yarn
yarn start
This should redirect you to http://localhost:3000
The frontend tests are done mainly with cypress, for this you should probably use a separate database, you can do that using the alternative docker-compose file
docker-compose -f docker-compose-e2e.yml up
cd frontend
yarn run cypress open
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.
There is a helper script for both frontend and backend tests:
./buid.sh
docker-compose run backend pytest
any arguments to pytest can also be passed after this command
docker-compose logs
Or for a specific service:
docker-compose logs -f name_of_service # backend|db
mv api_fake_keys.json api_keys.json
And fill the empty spaces with your own keys, optained in https://api.ufrn.br/
- Post Graduation
- User
- Course
- Attendance
- Official Document
- Researcher
- Covenant
- Participation
- Phone
- News
- Event
- Scheduled Report
- Student Advisor
- Staff
- Post Graduation
- User
- Course
- Researcher
- Attendance
- Student Advisor
- Participation
- Phone
- Event
- Scheduled Report
- News
- Official Document
- Covenant
- Staff
backend
└── app
├── alembic
│ └── versions # where migrations are located
├── api
│ └── api_v1
│ └── endpoints
├── core # config
│ └── utils # mainly external api access
├── db # db models
│ └── crud # crud operations
├── schemas # schemas
├── tests # pytest
└── main.py # entrypoint to backend
frontend
└── public
└── src
├── components
│ └── Home.tsx
├── config
│ └── index.tsx # constants
├── __tests__
│ └── test_home.tsx
├── index.tsx # entrypoint
└── App.tsx # handles routing