BrainMinder-server is a FastAPI-based template server designed as a scaffold for various projects. It includes essential features like routing, logging, environmental configuration, and comprehensive unit tests.
The project follows a structured directory layout:
app
├── config # Configuration related files (e.g., settings, environment configuration)
├── core # Core functionality (e.g., business logic, operations)
│ ├── base # Base classes or shared functionalities used across the core
│ ├── operations # Specific class folder example
│ ├── tests # Tests for the core functionalities
├── models # Database models or other data representations
├── routers # API route definitions, handling the HTTP requests
├── schemas # Pydantic schemas for request/response models
├── services # Business logic and service layer, coordinating between routers and models
├── utils # Utility modules for auxiliary functionality
│ ├── __init__.py # Initialization file for the utils module
│ ├── dependencies.py # Dependency injection and management
│ └── main.py # Main entry point and setup for the application
docs # Documentation for the project (e.g., API documentation, user guides)
notebooks # Jupyter notebooks for experiments, data analysis, prototyping
tests # Test cases for the routes and services
.env # Environment variables for local development
.env.example # Example environment variables file, serving as a template
.gitignore # Gitignore file specifying files and directories to be ignored by git
.pre-commit-config.yaml # Configuration for pre-commit hooks, automating code quality checks
docker-compose.yml # Docker Compose file for running multi-container Docker applications
Dockerfile # Dockerfile for building the production Docker image
Dockerfile.dev # Dockerfile for building the development Docker image
poetry.lock # Lock file generated by Poetry, ensuring consistent dependency versions
pyproject.toml # Configuration and metadata for Poetry, specifying dependencies and project settings
README.md # Project documentation, providing an overview and instructions
git clone <repository-url>
cd BrainMinder
code . #for vs code usersCreate a .env file in the root directory of the project by copying the provided .env.example and filling in the necessary values.
cp .env.example .envInstall main dependencies and set up a virtual environment using Poetry.
poetry installTo install both main dependencies and development dependencies:
poetry install --with devSet up pre-commit hooks by installing pre-commit in your environment and then running the installation command in the project root.
pip install pre-commit
pre-commit installRun test cases using pytest to ensure everything is set up correctly.
poetry run pytestUsing Docker Compose allows you to run your application in a containerized environment, ensuring consistency across different development and production setups.
Make sure your Docker daemon is running, then build and run the Docker images using the following command:
docker compose up -d --buildStart the services defined in your docker-compose.yml file:
docker compose upThis command will start all the services defined in the docker-compose.yml file. By default, your FastAPI application will be accessible at http://localhost:8000.
To stop the running services, use:
docker compose downDifferent repositories will be used for each part of the project: Front-end, Back for Front and Front for AI.