Welcome to the PrimeConnect API. This document will guide you through setting up the project on your local machine for development.
Before you begin, ensure you have the following installed on your laptop:
- Git
- Docker & Docker Compose (Recommended for easy setup)
- Python 3.8+ (If running without Docker)
- PostgreSQL (If running without Docker)
First, clone the repository and navigate into the backend directory:
git clone <your-repo-url>
cd primeconnect/primeconnect-apiThe project requires environment variables to run. We have provided a template file.
Copy the .env.example file to .env:
cp .env.example .envNote: The default values in .env.example are generally fine for local development.
Using Docker is the easiest way to run the API and PostgreSQL database together without installing PostgreSQL natively.
-
Start the containers in the background:
docker-compose up -d --build
-
Verify everything is running:
docker-compose logs -f
The container will automatically wait for the DB to start, run Alembic migrations, seed the admin user, and start the FastAPI server.
-
Stop the containers when you are done:
docker-compose down
If you prefer to run the application directly on your machine, follow these steps:
-
Start your local PostgreSQL server and create a database matching the credentials in your
.envfile. -
Create a virtual environment and activate it:
python -m venv .venv # On Windows: .venv\Scripts\activate # On macOS/Linux: source .venv/bin/activate
-
Install the dependencies:
pip install -r requirements.txt
-
Run database migrations:
alembic upgrade head
-
Seed the initial admin user:
python -m app.scripts.seed_admin
-
Start the development server:
uvicorn app.main:app --reload
Once the server is running (either via Docker or locally), you can access the API at:
- Base URL:
http://localhost:8000 - Swagger Documentation:
http://localhost:8000/docs(Interactive API docs) - ReDoc Documentation:
http://localhost:8000/redoc
Use the interactive Swagger documentation at /docs to explore endpoints and test requests. You can log in using the ADMIN_USERNAME and ADMIN_PASSWORD from your .env file.