
No more venturing into dark alleys
Website
·
Request Feature / Report Bug
Table of Contents
[WIP]
[WIP]
[WIP]
This project requires proper environment configuration for both development and production environments. Environment files contain sensitive configuration like API keys, database credentials, and other settings.
-
Copy the template file:
cp .env.template .env
-
Configure the environment variables in
.env
:# Google OAuth - Get this from Google Cloud Console (see Google OAuth Setup section) GOOGLE_CLIENT_ID=your_actual_client_id.apps.googleusercontent.com # JWT Configuration - Generate a secure random string SIGNING_SECRET=your-secure-signing-secret-here EXPIRATION_TIME_SECONDS="86400" # 24 hours # File Upload Configuration FILE_SIZE_LIMIT="50" # MB # Server Configuration PORT=8085 # Database Configuration (for local development) DB_NAME=cfmn_dev DB_HOST=localhost # Should be localhost for development DB_PORT=5432 DB_USER=cfmn_user DB_PASSWORD=cfmn_password # File Storage Paths (create these directories locally) UPLOADED_NOTES_PATH=cfmn/notes/uploaded PREVIEWS_PATH=cfmn/previews/uploaded LOG_LOCATION=/path/to/your/log/directory # Static Files Configuration STATIC_FILES_URL=http://localhost:8085 STATIC_FILE_STORAGE_LOCATION=/path/to/your/static/files
-
Copy the template file:
cp .production.env.template .production.env
-
Configure the environment variables in
.production.env
:# Google OAuth - Same as development but for production domain GOOGLE_CLIENT_ID=your_production_client_id.apps.googleusercontent.com # JWT Configuration - Use a different, secure signing secret for production SIGNING_SECRET=your-production-signing-secret-here EXPIRATION_TIME_SECONDS="86400" # File Upload Configuration FILE_SIZE_LIMIT="50" # Server Configuration PORT=8085 VITE_API_BASE_URL=https://your-production-api-url.com FRONTEND_BUILD_DIR=../frontend/dist/ # Database Configuration (for production) DB_NAME=cfmn_production DB_HOST=postgres # Docker service name or production database host DB_PORT=5432 DB_USER=your_production_db_user DB_PASSWORD=your_production_db_password # File Storage Paths (production paths) UPLOADED_NOTES_PATH=cfmn/notes/uploaded PREVIEWS_PATH=cfmn/previews/uploaded # Static Files Configuration (production) STATIC_FILES_URL=http://static.metakgp.org # Docker Container Paths LOG_LOCATION=/app/log STATIC_FILE_STORAGE_LOCATION=/app/static_files
The frontend also requires environment configuration:
For Development (frontend/.env.local
):
VITE_GOOGLE_CLIENT_ID=your_actual_client_id.apps.googleusercontent.com
VITE_API_BASE_URL=http://localhost:8085
For Production (frontend/.env.production
):
VITE_GOOGLE_CLIENT_ID=your_production_client_id.apps.googleusercontent.com
VITE_API_BASE_URL=https://your-production-api-url.com
- Never commit actual environment files (
.env
,.production.env
) to version control - Generate secure, random signing secrets for production environments
- Use different Google OAuth Client IDs for development and production
- Ensure database credentials match your actual database configuration
- Create required directories specified in file paths before running the application
This project requires Google OAuth for authentication. You need to set up a Google OAuth client and configure the client ID in multiple environment files.
- Go to the Google Cloud Console
- Create a new project or select an existing one
- Navigate to APIs & Services > Credentials
- Click Create Credentials > OAuth client ID
- If prompted, configure the OAuth consent screen first:
- Choose External user type
- Fill in the required fields (App name, User support email, Developer contact email)
- Add your domain to Authorized domains if deploying to production
- For Application type, select Web application
- Add your Authorized Javascript origins:
- For development:
http://localhost:5173
andhttp://localhost
- For production:
https://cfmn.metakgp.org
(frontend URL)
- Click Create and copy the Client ID. Client Secret is not needed for this project.
You need to set the Google Client ID in the following environment files:
Frontend Environment Files:
frontend/.env.local
(for development)frontend/.env.production
(for production builds)
VITE_GOOGLE_CLIENT_ID=your_google_client_id_here
Root Environment Files:
project_root/.env
(for development)project_root/.production.env
(for production)
GOOGLE_CLIENT_ID=your_google_client_id_here
Make sure all four files contain the correct Google Client ID:
- Frontend uses
VITE_GOOGLE_CLIENT_ID
(Vite environment variable) - Backend/root uses
GOOGLE_CLIENT_ID
(standard environment variable)
This project uses a PostgreSQL database. The database schema and initial data are defined in project_root/database/init.sql
.
For development, the database is automatically set up using Docker Compose:
-
Configure database parameters in
docker-compose.dev.yml
:services: postgres: image: postgres:16-alpine container_name: cfmn-dev-db environment: POSTGRES_DB: cfmn_dev POSTGRES_USER: cfmn_user POSTGRES_PASSWORD: cfmn_password volumes: - ./database/init.sql:/docker-entrypoint-initdb.d/init.sql - postgres-data-dev:/var/lib/postgresql/data ports: - "5432:5432" volumes: postgres-data-dev: name: postgres-data-dev
-
The database will be automatically initialized when you run:
docker-compose -f docker-compose.dev.yml up
-
Database initialization includes:
- Creating tables and schemas defined in
project_root/database/init.sql
- Setting up initial data
- Configuring database constraints and indexes
- All queries in
init.sql
are executed automatically on first startup
For production deployment, you need to manually set up the database:
-
Create a PostgreSQL database (probably Database of Babel)
-
Execute the initialization queries from
project_root/database/init.sql
:psql -h your_host -U your_user -d your_database -f project_root/database/init.sql
-
Configure your production environment variables with the database connection details:
DATABASE_URL=postgresql://username:password@host:port/database # or individual parameters DB_HOST=your_database_host DB_PORT=5432 DB_NAME=your_database_name DB_USER=your_database_user DB_PASSWORD=your_database_password
The project_root/database/init.sql
file contains:
- Table definitions for users, notes and votes
- Foreign key constraints and relationships
Make sure to review and customize the database configuration based on your specific requirements.
[WIP]
[WIP]
The currently active maintainer(s) of this project.
Honoring the original creator(s) and ideator(s) of this project.