Modal is a serverless cloud platform that can run the Timeful Go backend as a persistent HTTP service. TheDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/ptshen/timeful-plus/llms.txt
Use this file to discover all available pages before exploring further.
modal_backend.py entrypoint in the repository packages the Go binary built from Dockerfile.modal and exposes it over HTTPS. Modal handles infrastructure, scaling, and cold-start behaviour — you only pay for actual compute time.
This deployment covers only the backend. Your frontend is still deployed separately (e.g., on Vercel — see Vercel + Railway) and routes
/api/* requests to the Modal service URL.What This Deployment Covers
| Component | Hosting |
|---|---|
| Go backend (API server) | Modal — modal_backend.py |
| Vue 2 frontend (SPA) | Separate — Vercel or self-hosted Nginx |
| MongoDB database | MongoDB Atlas or self-hosted |
Files Involved
| File | Purpose |
|---|---|
modal_backend.py | Modal app definition — builds the container and starts the Go server |
Dockerfile.modal | Modal-specific Docker image (Alpine + Python runtime required by Modal) |
modal.env.example | Template for the environment variables to inject as a Modal secret |
Prerequisites
Modal CLI
Install with
pip install modal and authenticate with modal token new.Railway (or existing backend env)
If you already deployed via Railway, copy the env vars from there into
modal.env.modal commands:
Setup Steps
Create modal.env from the Template
Copy the example file and fill in your values. These are the same environment variables used in the Railway deployment:Open
modal.env and set the following:Create the Modal Secret
Upload the environment file as a Modal secret named Modal stores the values securely and injects them into the container at runtime. You can update individual values later from the Modal dashboard without redeploying.
timeful-backend-secrets:Deploy the Backend
Run the deploy command from the repository root:Modal will:
- Build the Docker image using
Dockerfile.modal. - Push the image to Modal’s internal registry.
- Start the Go server and attach the
timeful-backend-secretssecret. - Print the public HTTPS URL for your service.
vercel.json and Google OAuth.After Deployment
Once Modal reports a live URL, update the following:-
vercel.jsonrewrite — replace the Railway destination with your Modal URL: -
Modal secret — update
BASE_URLandCORS_ALLOWED_ORIGINSto your Vercel frontend URL, then redeploy: - Google OAuth — add the Modal URL to Authorized redirect URIs if you are not routing through Vercel.
Warm Container Behaviour
Themodal_backend.py app sets min_containers=1, which keeps one container warm at all times. This means:
- No cold-start latency for users.
- A small amount of continuous compute cost even when idle.
- Modal will still scale up additional containers if traffic spikes.
Google Cloud Tasks (Optional)
Google Cloud Tasks integration is optional. If you do not use it, leaveSERVICE_ACCOUNT_KEY_PATH unset in modal.env. The backend starts and operates normally without it — scheduled reminders and background task processing simply will not run.
To enable Cloud Tasks, generate a service account key JSON from the Google Cloud Console, upload it as an additional Modal secret or volume mount, and set:
Related Pages
Vercel + Railway
The standard cloud deployment combining Vercel frontend with Railway backend.
Self-Hosting with Docker
Run all three services locally with Docker Compose.