There are several ways of editing your application.
Use your preferred IDE
If you want to work locally using your own IDE, you can clone this repo and push changes. Pushed changes will also be reflected in Lovable.
The only requirement is having Node.js & npm installed - install with nvm
Follow these steps:
# Step 1: Clone the repository using the project's Git URL.
git clone <YOUR_GIT_URL>
# Step 2: Navigate to the project directory.
cd <YOUR_PROJECT_NAME>
# Step 3: Install the necessary dependencies.
npm i
# Step 4: Start the development server with auto-reloading and an instant preview.
npm run devEdit a file directly in GitHub
- Navigate to the desired file(s).
- Click the "Edit" button (pencil icon) at the top right of the file view.
- Make your changes and commit the changes.
Use GitHub Codespaces
- Navigate to the main page of your repository.
- Click on the "Code" button (green button) near the top right.
- Select the "Codespaces" tab.
- Click on "New codespace" to launch a new Codespace environment.
- Edit files directly within the Codespace and commit and push your changes once you're done.
This project is built with:
- Vite
- TypeScript
- React
- shadcn-ui
- Tailwind CSS
This project now includes:
- Admin route:
/admin - Password-protected admin login using secure HTTP-only cookies
- Blog/News publishing from admin panel
- Public stories pages:
/stories/stories/:slug
- Vercel API routes under
api/
Create .env.local from .env.example and set:
ADMIN_EMAIL: admin login emailADMIN_PASSWORD_HASH: bcrypt hash of your admin password (recommended)ADMIN_PASSWORD: plain password fallback (dev only)ADMIN_JWT_SECRET: random strong secret for JWT signingDATABASE_URL: Neon/Postgres connection string (primary data store)UPSTASH_REDIS_REST_URLandUPSTASH_REDIS_REST_TOKEN: persistent post storageBLOB_READ_WRITE_TOKEN: image upload storage
- Normalized Postgres schema lives in
db/schema.sql - Initial migration file:
db/migrations/001_initial.sql - Runtime adapter auto-creates required tables when
DATABASE_URLis set - Fallback mode (if no
DATABASE_URL): Redis/memory storage
- On first request with Postgres enabled, admin user is auto-seeded from:
ADMIN_EMAILADMIN_PASSWORD_HASH(orADMIN_PASSWORDfallback)
- Auth sessions are persisted in
sessionstable (token hash only) - Audit events written to
audit_logsfor:- login success/failure
- logout
- post create/update/delete
- Internal endpoint:
/api/internal/publish-scheduled - Guarded by
CRON_SECRET - Vercel cron is configured in
vercel.jsonto run every 10 minutes - Any post with:
status = scheduledpublished_at <= nowis auto-promoted topublished
- Admin analytics endpoint:
/api/admin/analytics - Admin dashboard cards: post counts + 24h activity
- Public stories filters:
- type (blog/news)
- search (title/excerpt)
- tag filter
- Write endpoint throttling for admin create/update/delete/upload requests
- Admin post list pagination (
page,limit) on/api/admin/posts
Run this once and copy output into ADMIN_PASSWORD_HASH:
node -e "import('bcryptjs').then(({default: b})=>b.hash('yourStrongPassword', 12).then(console.log))"- Push repository to GitHub.
- Import project in Vercel.
- Configure all environment variables in Vercel project settings.
- Deploy.
vercel.json is configured so API routes work alongside SPA routes.
Pre-deploy:
- Set all required env vars in Vercel.
- Run config check locally (or CI):
npm run check:prod-configIf you only want a report without failing exit code:
node scripts/check-prod-config.mjs --report-onlyPost-deploy smoke checks:
- Verify public list API:
curl https://<your-domain>/api/posts- Verify cron job endpoint manually:
curl -X POST https://<your-domain>/api/internal/publish-scheduled -H "Authorization: Bearer <CRON_SECRET>"- Verify admin login endpoint:
curl -X POST https://<your-domain>/api/admin/auth/login -H "Content-Type: application/json" -d '{"email":"<ADMIN_EMAIL>","password":"<PASSWORD>"}'