ApiSquare is designed for Vercel — the includedDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/shadownrx/apisquare/llms.txt
Use this file to discover all available pages before exploring further.
vercel.json declares "framework": "nextjs" and the app relies on @vercel/kv for persistent storage. Vercel’s serverless architecture maps cleanly onto the Next.js App Router, and each API route (including /api/webhook) is deployed as its own serverless function with no additional configuration required.
Prerequisites
Before deploying, make sure you have the following ready:- A Vercel account and the Vercel CLI installed globally:
- A Telegram bot token obtained from @BotFather
- Node.js 18 or later installed locally
Deployment Steps
Create a Vercel KV database
ApiSquare uses
@vercel/kv for storing appointment data. You must provision a KV database and link it to your project before deploying.- Open the Vercel Dashboard and navigate to Storage.
- Click Create and choose KV (Redis).
- Link the new database to your ApiSquare project.
- Pull the generated credentials into your local environment:
KV_URL, KV_REST_API_URL, KV_REST_API_TOKEN, and KV_REST_API_READ_ONLY_TOKEN into .env.local so local development works against the same store.Set required environment variables
Add the three required application secrets via the Vercel CLI:The script prints a
ADMIN_PASSWORD must be stored as a bcrypt hash, not plain text. Use the bundled helper script to generate it:$2b$10$... hash that you can paste directly when prompted by vercel env add.Deploy to production
Run a production deployment with the Vercel CLI:The CLI will output your deployment URL once the build completes. Take note of it — you will need it in the next step. For example:
Register the Telegram webhook
Telegram delivers updates to your app by POSTing to a webhook URL. Register it using the bundled setup script, passing your production URL as the argument:On success you will see:
vercel.json Configuration
The entire Vercel configuration for ApiSquare is intentionally minimal:
vercel.json
app/api/ becomes a serverless function, and static assets are served from Vercel’s edge CDN with no extra configuration.
next.config.js Configuration
ApiSquare’s Next.js configuration file is intentionally empty — no custom settings are needed beyond the framework defaults:
next.config.js
npm Scripts Reference
The following scripts are defined inpackage.json and available during local development and CI:
| Script | Command | Purpose |
|---|---|---|
dev | next dev | Start the development server on http://localhost:3000 |
build | next build | Compile the application for production |
start | next start | Start a production server locally |
lint | next lint | Run ESLint across the project |
setup-webhook | node setup-webhook.js | Register the Telegram webhook URL |
npm run <name>, for example npm run dev.
Automatic Deployments
Connect your GitHub repository to Vercel to enable continuous deployment:- In the Vercel Dashboard, go to Add New → Project and import your GitHub repository.
- Vercel will automatically trigger a production build on every push to
mainormaster. - Pull requests generate isolated preview deployments at unique URLs such as
https://apisquare-git-feature-xxx.vercel.app.