A dockerized FastAPI App with 2 options of rendering (server-side and React frontend).
Provides the opportunity for users' articles navigation with standard user authentication system.
PostgreSQL is used for collecting data about users and their articles, MongoDB is used for registrating events. The rendering server has some additional functionality compared with the React frontend: it is connected with RabbitMQ and Sentry. RabbitMQ is used while the rendering server pushes message about a new registered user into a queue and the listening server listens to this queue. Sentry is used for registrating server errors.
This project was built using these tools:
Tool | Description |
---|---|
FastAPI | "Web framework for building APIs with Python" |
PostgreSQL | "An open source object-relational database system" |
SQLAlchemy | "The Python SQL toolkit and Object Relational Mapper" |
Alembic | "A lightweight database migration tool for usage with the SQLAlchemy" |
MongoDB | "A NoSQL database program" |
React | "A JavaScript library for building user interfaces" |
RabbitMQ | "An open source message broker" |
poetry | "Python dependency management and packaging made easy" |
Py.Test | "A mature full-featured Python testing tool" |
Sentry | "Application Monitoring and Error Tracking Software" |
Copy a project
$ git clone [email protected]:Dddarknight/articles-api.git
$ cd articles-api
Set up environment variables
$ touch .env
# You have to fill .env file. See .env.example.
# You will have to fill username and password fields for PostgreSQL, RabbitMQ, email (from this email messages will be sent to moderators). If you don't have these credentials, please follow the instructions in the official documentation.
# To get a SECRET_KEY for FastAPI run:
$ openssl rand -hex 32
Set up environment variables for frontend
$ cd frontend
$ touch .env
# Then you have to fill .env file in frontend for Firebase project configuration. See .env.example.
Working with Docker
$ cd ..
# If you haven't used Docker earlier, you should follow the installation instruction on the official website (https://docs.docker.com/engine/install/).
# Then:
$ sudo apt install docker-compose
$ docker-compose up -d --build
Functionality connected with users management
Page | Description |
---|---|
Sign-up | First you need to register in the app using the provided form of registration. |
Log in | Then you have to log in using the information you've filled in the registration form. JSON Web Tokens are used for authorization. |
Users | You can see list of all users on the relevant page. |
User | The information about the user. The user's data can be changed or deleted only by the authorized user. |
Functionality connected with articles management
Page | Description |
---|---|
Articles | Here you can see the list of users' articles. Also here you can create a new article. |
Article | Only authorized user's article can be changed or deleted. |