Before you begin, ensure you have the following installed:
Before we run any code we need to set up a MongoDB account and make sure free cluster, since it's not necessary to pay.
- Create a MongoDB Atlas account
- Create a new cluster
- In the MongoDB Atlas dashboard:
- Click "Connect"
- Choose "Connect your application"
- Copy your connection string
-
Copy the
config.test.env
file to create a new.env
file:cp config.test.env .env
-
Fill in the MongoDB settings in your
.env
file:Within the MongoDB atlas dashboard, if you press connect, you can find information you need to add into your
.env
.MONGODB_DB_NAME=your_database_name MONGODB_USER=your_username MONGODB_PASSWORD=your_password MONGODB_HOST=...mongodb.net MONGODB_PROTOCOL=mongodb+srv # <MONGODB_PROTOCOL>://<MONGODB_USER>:<MONGODB_PASSWORD>@<MONGODB_HOST>/?retryWrites=true&w=majority&appName=<MONGODB_DB_NAME>
-
Update other environment variables as needed:
SECRET_KEY
: Generate a secure secret keyPROJECT_NAME
: Your project nameSENTRY_DSN
: (Optional) Not needed for now, mainly using Sentry for error tracking
-
Create and activate a Python virtual environment \w any virtual environment of choice:
# Using venv python -m venv .venv # Activate on Windows .venv\Scripts\activate # Activate on macOS/Linux source .venv/bin/activate
# Create a new conda environment conda create --name myenv python=3.12 # Activate the conda environment conda activate myenv
-
Install Python dependencies:
pip install -r requirements.txt
- Install Node.js dependencies:
npm install
Start both frontend and backend with a single command:
npm run dev # or make frontend
For just starting the backend you can look into package manager, and see where just running
uvicorn api.main:app --reload # or make backend
The application will be available at (assuming those ports were open):
- Frontend: http://localhost:3000
- Backend API: http://localhost:8000
The API is configured with the following default settings:
- API prefix:
/api/
- Token expiration: 30 days
- CORS enabled for:
- Always change the
SECRET_KEY
in production - Ensure proper CORS settings for production environments
- Never commit the
.env
file to version control - Use secure passwords for MongoDB
- Fork the repository
- Create a feature branch
- Commit your changes
- Push to the branch
- Open a Pull Request