Getting Started with Rhesis Backend
This guide will help you set up and run the Rhesis backend on your local machine for development purposes.
Prerequisites
Before you begin, make sure you have the following installed:
- Python 3.10 or higher
- PostgreSQL 13 or higher
- UV package installer
- Git
Clone the Repository
Environment Setup
- Navigate to the backend directory:
- Create a Python virtual environment:
- Activate the virtual environment:
On Linux/macOS:
On Windows:
- Install dependencies using UV:
Database Setup
- Create a PostgreSQL database:
- Create a
.env
file based on the provided template:
- Update the database connection string in
.env
:
- Run database migrations:
Running the Application
- Start the FastAPI server:
The API will be available at http://localhost:8000
- Open the API documentation:
- Swagger UI: http://localhost:8000/docs
- ReDoc: http://localhost:8000/redoc
Running Background Tasks
- Start a Celery worker:
Development Workflow
Code Formatting
Format code using ruff:
Linting
Run the linter:
Fix linting issues automatically:
Running Tests
Run the test suite:
pytest
Authentication Setup
For local development, you can use Auth0 or set up a mock authentication system.
Auth0 Configuration
- Create an Auth0 application at https://auth0.com/
- Update the Auth0 configuration in your
.env
file:
AUTH0_DOMAIN=your-domain.auth0.com
AUTH0_AUDIENCE=your-audience
AUTH0_CLIENT_ID=your-client-id
AUTH0_CLIENT_SECRET=your-client-secret
AUTH0_SECRET_KEY=your-secret-key
API Endpoints
Once the application is running, you can explore the available endpoints through the Swagger UI at http://localhost:8000/docs .
Next Steps
Now that you have the backend running, you can:
- Create your first organization and user
- Explore the API endpoints
- Set up the frontend application to interact with the backend
- Start developing new features
For more detailed information about the backend architecture and components, refer to the other documentation files in this directory.