Setup & Installation¶
Prerequisites¶
Python 3.10 or later
Flutter SDK 3.9 or later
A Supabase project (free tier is sufficient)
Google Cloud project with OAuth 2.0 credentials (for Google Sign-In)
Backend Setup¶
Clone the repository and enter the backend directory:
git clone <repo-url> cd LinguaAI/backend
Create and activate a virtual environment:
# macOS / Linux python -m venv venv source venv/bin/activate # Windows python -m venv venv venv\Scripts\activate
Install dependencies:
pip install -r requirements.txt
Create a
.envfile inbackend/with the following variables:SUPABASE_URL=https://<project-ref>.supabase.co SUPABASE_KEY=<service_role_key> CLIENT_ID=<google_oauth_web_client_id> CLIENT_ID_AND=<google_oauth_android_client_id> SECRET_KEY=<google_oauth_secret> JWT_SECRET_KEY=<your_random_secret> RESEND_API_KEY=<resend_email_api_key> EMAIL_FROM=onboarding@resend.dev
Warning
Use the service role key for
SUPABASE_KEY. This key bypasses Row Level Security and must never be exposed to the client.Apply database migrations:
# Requires the Supabase CLI (https://supabase.com/docs/guides/cli) supabase db push
Start the development server:
uvicorn app.main:app --reload
The API will be available at
http://127.0.0.1:8000. Interactive documentation (Swagger UI) is athttp://127.0.0.1:8000/docs.
Environment Variables Reference — Backend¶
Variable |
Required |
Description |
|---|---|---|
|
Yes |
Full URL of the Supabase project (e.g. |
|
Yes |
Supabase service role secret key |
|
Yes |
Google OAuth 2.0 web client ID |
|
Yes |
Google OAuth 2.0 Android client ID |
|
Yes |
Google OAuth client secret |
|
Yes |
Secret used to sign JWTs (min. 32 random characters recommended) |
|
No |
API key for Resend to send welcome emails |
|
No |
Sender email address for welcome emails (default: |
Frontend Setup¶
Enter the frontend directory:
cd LinguaAI/frontend
Install Flutter dependencies:
flutter pub get
Create a
.envfile infrontend/with the following variables:SUPABASE_URL=https://<project-ref>.supabase.co SUPABASE_KEY=<anon_key> CLIENT_WEB=<google_oauth_web_client_id> CLIENT_ANDROID=<google_oauth_android_client_id> SECRET_KEY=<google_oauth_secret>
Note
Use the anon key for
SUPABASE_KEYin the frontend. Row Level Security policies determine what the anonymous key can access.Update
lib/services/api_config.dartto point to your backend:static const String baseUrl = 'http://<your-backend-host>:8000';
Run the application:
flutter run # Connected device or emulator flutter run -d chrome # Web browser
Environment Variables Reference — Frontend¶
Variable |
Required |
Description |
|---|---|---|
|
Yes |
Full URL of the Supabase project |
|
Yes |
Supabase anon (public) key |
|
Yes |
Google OAuth 2.0 web client ID |
|
Yes |
Google OAuth 2.0 Android client ID |
|
Yes |
Google OAuth client secret |
Useful Commands¶
Command |
Description |
|---|---|
|
Start backend dev server with hot-reload |
|
Run all backend tests |
|
Run a single test file |
|
Run tests matching a name pattern |
|
Install/update Flutter packages |
|
Run the app as a web app |
|
Lint the Flutter codebase |
|
Build an Android APK |
Deployment¶
A CI/CD workflow is available in .github/workflows/deploy.yml which deploys the backend using Docker. To build and run the Docker container manually:
cd LinguaAI/backend
docker build -t linguaai-backend .
docker run --env-file .env -d -p 8000:8000 linguaai-backend