The KERN API is a FastAPI application deployed to Vercel using theDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/jaimegayo/KERNDOCUMENTATION/llms.txt
Use this file to discover all available pages before exploring further.
@vercel/python runtime. All HTTP traffic is routed through a single entry point at api/index.py. The database tables are created automatically on first startup, so you don’t need to run migrations manually.
Prerequisites
Configuration files
vercel.json
Vercel uses this file to know how to build and route requests:vercel.json
api/index.py, which mounts the FastAPI application.
requirements.txt
Vercel installs these dependencies before each deployment:requirements.txt
Environment variables
Set these in your Vercel project’s Settings → Environment Variables panel before deploying.| Variable | Description |
|---|---|
DATABASE_URL | PostgreSQL connection string from Neon |
SECRET_KEY | Secret used to sign JWT tokens |
DATABASE_URL format:
asyncpg driver format shown above — the API strips any ?sslmode=require suffix and manages SSL via the connection arguments directly.
Database tables
The API callscreate_db_and_tables_sync() on startup. This function uses SQLAlchemy to inspect the database and create any missing tables:
| Table | Purpose |
|---|---|
users | User accounts, credentials, and profile data |
routines | Training plans created by or assigned to users |
routine_exercises | Individual exercises and sets within each routine |
workout_sessions | Completed workout history (volume, duration, steps) |
checkfirst=True.
Deployment steps
Fork or clone the repository
Fork the KERN API repository to your GitHub account, then connect it to a new Vercel project via the Vercel dashboard or the
vercel CLI.Create a Neon database
Sign in to Neon, create a new project, and copy the connection string from Connection Details. Make sure to select the
asyncpg (async Python) format if available, or start with the standard postgresql:// string and replace postgresql:// with postgresql+asyncpg://.Set environment variables in Vercel
In your Vercel project, go to Settings → Environment Variables and add:
DATABASE_URL— your Neon connection stringSECRET_KEY— a long, random string (use a password generator)
Deploy
Push a commit to your main branch, or trigger a manual deployment from the Vercel dashboard. Vercel will install dependencies from
requirements.txt, build the project, and start the serverless function.On the first request after deployment, the API will create the database tables and log [INFO] Tablas de base de datos listas y verificadas.Verifying the deployment
Once deployed, visit/docs on your Vercel URL to access the FastAPI auto-generated Swagger UI. You can test every endpoint interactively without writing any code.