Follow these steps to set up the project locally and connect it to your Supabase database.
- Node.js (v18 or higher)
- Python (3.10 or higher)
- A Supabase account and project
- Go to Supabase and create a new project.
- In your Supabase dashboard, navigate to Project Settings > Database.
- Under Connection string, copy the URI (Make sure to replace
[YOUR-PASSWORD]with your actual database password).
-
Navigate to the backend directory:
cd backend -
Create a virtual environment and activate it:
# Windows python -m venv venv venv\Scripts\activate # macOS/Linux python3 -m venv venv source venv/bin/activate
-
Install the required dependencies:
pip install -r requirements.txt
-
Create a
.envfile in the root of the backend directory:DATABASE_URL=postgresql+psycopg2://postgres.[your-project-ref]:[your-password]@://supabase.com
(Note: Adjust the driver name like
postgresql+psycopg2orpostgresql+asyncpgbased on your SQLAlchemy setup). -
Run database migrations (if using Alembic):
alembic upgrade head
Alternatively, if your app runs
Base.metadata.create_all(bind=engine)on startup, you can skip this. -
Start the FastAPI development server:
uvicorn main:app --reload
The backend API will be available at
http://localhost:8000. You can view the API documentation athttp://localhost:8000/docs.
-
Open a new terminal and navigate to the frontend directory:
cd frontend -
Install the dependencies:
npm install # or yarn install -
Create a
.env.localfile in the root of the frontend directory to point to your FastAPI backend:NEXT_PUBLIC_API_URL=http://localhost:8000
-
Start the Next.js development server:
npm run dev # or yarn devOpen
http://localhost:3000in your browser to see the application running.
- Verify Backend Connection: Open
http://localhost:8000/docsand use the POST/todosendpoint to create a test todo item. - Check Supabase: Go to your Supabase Table Editor to confirm the item was successfully written to your PostgreSQL database.
- Test UI Workflow: Open
http://localhost:3000, try adding, completing, and deleting tasks. The UI should instantly reflect changes made in the Supabase database.