The project is structured as follows, ensuring modular and organized management of various functionalities:
project_root
│
├── src
│ ├── routers
│ │ ├── hello.py
│ │ ├── auth.py
│ │ ├── url-short.py
│ │ └── team.py
│ ├── config.py
│ ├── db.py
│ ├── main.py
│ ├── __init__.py
│ └── schemas.py
├── .env
├── .env.example
├── .gitignore
├── README.md
└── requirements.txt
-
Install dependencies:
-
Setup environment variables:
- Copy the
.env.example
to a new file called.env
.cp .env.example .env
- Open the
.env
file and populate it with the necessary values for each variable:JWT_KEY
: Enter a secure key for encoding and decoding JSON Web Tokens.CORS_ORIGINS
: Define the allowed origins for Cross-Origin Resource Sharing. Use*
for allowing all origins in a development environment.DATABASE_URL
: Input the connection URI for your MongoDB Instance
- Copy the
-
Run the application:
uvicorn src.main:app --reload
This will start the FastAPI application with hot reloading enabled.
pip install -r requirements.txt
-
User SignUp: Endpoint:
POST /signup
Payload:
{ "name": "John Doe", "email": "johndoe@example.com", "password": "your_password" }
-
User Login: Endpoint:
POST /login
Payload:
{ "email": "johndoe@example.com", "password": "your_password" }
Response:
{ "status": "success", "token" : "jwt_token" }