('-. .-') _ .-') ( OO ).-. ( OO ).( '.( OO )_ ,------./ . --. /(_)---\_),--. ,--.).-'),-----. ('-| _.---'| \-. \ / _ | | `.' |( OO' .-. ' (OO|(_\ .-'-' | |\ :` `. | |/ | | | | / | '--.\| |_.' | '..`''.)| |'.'| |\_) | |\| | \_)| .--' | .-. |.-._) \| | | | \ | | | | \| |_) | | | |\ /| | | | `' '-' ' `--' `--' `--' `-----' `--' `--' `-----'
FASMO - FastAPI SvelteKit MongoDB
The project structure for the backend is inspired by this repository.
The frontend of the project is built using SvelteKit, initialized with the command:
npm create svelte@latest fasmo
1. Create a Virtual Environment (venv)
Create a virtual environment (venv) using conda with the following command:
conda create -n [venv-name] python=3.10
Activate the venv with the following command:
conda activate [venv-name]
2. Install requirements
Install the required dependencies with the following command:
pip install -r requirements/dev.txt
3. Create the .env File
Create and update .env
file based on .env.example
cp .env.example .env
4. Run the backend
Run the server with the following command:
sh script/start-dev.sh
5. Open the API Documentation
The API documentation can be opened in a browser at the following address:
http://localhost:8000/docs
1. Go to frontend folder
Go to frontend folder and install dependencies:
cd frontend
npm install
2. Create the .env File
Create and update .env
file based on .env.example
cp .env.example .env
3. Run the frontend
Run development server
npm run dev
# or start the server and open the app in a new browser tab
npm run dev -- --open
To make the code cleaner and more structured
Backend:
sh scripts/lint-fromat.sh
Frontend:
npm run lint
npm run format
Before you begin, ensure you have Docker installed.
1. Create environment files
For the backend:
cp .env.example .env
For the frontend:
cd frontend
cp .env.example .env
cd ..
Open each .env
file you have created and update the values as needed.
2. Build and run the Docker containers
docker compose up --build -d
Wait a few minutes for the setup to complete. You can then access:
- Frontend at http://localhost:5000
- Backend at http://localhost:8000