Urban Flame is an eight-page restaurant website for a fictional flame-grill restaurant
in Indiranagar, Bengaluru. It uses hand-written HTML, CSS, and JavaScript. There is no
build step: the public/ directory is the website that hosts publish.
This is a personal research and demonstration project, not a real restaurant service. The restaurant details, menu, prices, contact information, and bookings are fictional.
Try the deployed website: Urban Flame
The demo is publicly accessible for evaluation. Its displayed restaurant contact details are demonstration data and are not monitored.
The project also includes an optional PostgreSQL-backed API for accounts, bookings, and
enquiries. Vercel can run the API and share records through the database. Static hosts
such as GitHub Pages and Netlify publish the frontend only, so those deployments use the
browser's localStorage fallback.
- Responsive layout from 320px upward.
- Restaurant home page, menu, booking, about, contact, account, and staff pages.
- Menu search and course filters that preserve their state in the URL.
- Booking availability based on service hours, party size, and remaining capacity.
- PostgreSQL bookings with slot counters and a database capacity constraint.
- Account creation and login with scrypt on the server and PBKDF2 in local mode.
- Enquiries that staff can view and mark as handled.
- Staff access controlled by the
ADMIN_EMAILSenvironment variable. - Local mode for development without a database.
- Security headers, same-origin checks, rate limiting, secure session cookies, and no third-party runtime requests.
- Automated link, markup, contract, API, and responsive-layout checks.
| Mode | Use it when | Data location |
|---|---|---|
| Vercel + PostgreSQL | You need shared accounts, bookings, enquiries, and staff access | PostgreSQL and server sessions |
| Local server + PostgreSQL | You want to develop the full application locally | Your PostgreSQL database |
| Local server without PostgreSQL | You only need to preview or develop the frontend | Browser localStorage |
| GitHub Pages or Netlify | You want a static deployment | Browser localStorage |
Vercel with PostgreSQL is the recommended deployment mode. The frontend detects the
backend by calling GET /api/health. If the database or schema is unavailable, the
frontend uses local mode and changes its messages so it does not claim that data was
stored on the server.
All published pages are in public/:
| Page | Purpose |
|---|---|
index.html |
Home page, restaurant introduction, gallery, login, and account summary |
menu.html |
Menu with six courses, search, filters, and an empty state |
book.html |
Table booking, availability, booking lookup, and cancellation |
aboutus.html |
Restaurant story, kitchen information, and capacity details |
contact.html |
Enquiry form, sample contact details, opening hours, and directions |
signup.html |
Account creation and password-strength feedback |
admin.html |
Staff-only view of bookings and enquiries |
404.html |
Not-found page |
admin.html is intentionally not linked from the public navigation. It is also excluded
from search engines with robots.txt, a meta tag, and the X-Robots-Tag response header.
The page is not the security boundary: every staff API request checks the signed-in email
against ADMIN_EMAILS on the server.
The screenshots are full-page captures at 1280px wide. They are stored in docs/ and
are not part of the deployed website. The committed captures were generated from the
local no-database mode, so dynamic server-backed text such as booking availability may
differ from the public Vercel deployment. Run npm run screenshots to regenerate them.
- Node.js 22, 23, or 24.
- npm, included with Node.js.
- A PostgreSQL database only if you want server mode.
- Chrome or Edge for the responsive and screenshot commands.
- Python and Pillow only if you want to regenerate optimized images.
The supported Node.js range is also declared in package.json and used by the GitHub
Actions workflow.
These steps run the complete website locally without requiring a database.
git clone https://github.com/gunargrithvick/urban-flame.git
cd urban-flame
npm ci
npm startOpen http://localhost:8080 in a browser. The local server serves public/ and routes
/api/* to the same handlers that Vercel uses. Without a database, the API reports that
the database is unavailable and the frontend stores accounts, bookings, and enquiries in
the current browser.
To serve only the static frontend, use this command instead:
npm run serve
Use npm start when you want to exercise the API routing. Use npm run serve when you
only need a static preview.
-
Create a PostgreSQL database. A hosted provider such as Neon or Supabase works, as does a local PostgreSQL installation.
-
Copy the environment template.
macOS or Linux:
cp .env.example .env
Windows PowerShell:
Copy-Item .env.example .env -
Open
.envand replace the exampleDATABASE_URLwith your database connection string. The project also acceptsPOSTGRES_URL; if both are set,DATABASE_URLis used first. -
Apply the schema once:
npm run db:init
The command applies
lib/schema.sql, checks that all six tables exist, and is safe to run again. The API does not apply the schema automatically because several serverless functions could otherwise try to create the tables at the same time. -
Start the application:
npm start
-
Check http://localhost:8080/api/health. A healthy server-mode response includes:
{ "ok": true, "db": true, "schema": true, "timezone": "Asia/Kolkata" }
Never commit .env. It is ignored by Git. The example file is safe to commit because it
contains only a local example connection string and no real credentials.
ADMIN_EMAILS is a comma-separated list of email addresses allowed to use the staff API.
The comparison is case-insensitive. Leave it empty to disable staff access.
For a local database:
- Add the email to
ADMIN_EMAILSin.env. - Restart
npm start. - Create an account with that same email through
signup.html. - Open
admin.htmlafter signing in.
For Vercel, add ADMIN_EMAILS to the Production environment, then redeploy. Create the
account through the deployed sign-up page and open /admin.html. Do not put an admin
password in this README, in Git, or in an environment variable. Passwords belong in the
account form and are stored only as hashes.
All variables are optional. Without a database connection, the site remains usable in local mode.
| Variable | Required | Description |
|---|---|---|
DATABASE_URL |
No | PostgreSQL connection string. Preferred name when configuring the project yourself. |
POSTGRES_URL |
No | Accepted alias used by some Vercel database integrations. |
ADMIN_EMAILS |
No | Comma-separated staff email addresses. Empty disables staff access. |
UF_INSECURE_COOKIES |
No | Set to 1 only for plain HTTP local development. npm start sets it automatically when it is unset. Never set it on a deployed site. |
Vercel is the recommended host because it can run both public/ and api/.
The current public production deployment is
https://urban-flame-sooty.vercel.app/. Use this production domain when sharing the
project; individual Vercel deployment URLs may be protected by Vercel Authentication.
-
Push the repository to GitHub.
-
Import the repository into Vercel.
-
Keep the framework preset as Other. Do not add a build command.
vercel.jsonalready setspublic/as the output directory. -
Connect a PostgreSQL provider or add
DATABASE_URLorPOSTGRES_URLin Vercel's project environment variables. Add it to Production and Preview as appropriate. -
Add
ADMIN_EMAILSif staff access is needed. -
Initialize the production database once by running
npm run db:initlocally with the production connection string, or by applyinglib/schema.sqlin your provider's SQL editor. -
Redeploy after changing environment variables. Existing deployments do not use newly changed environment values until they are redeployed.
-
Verify these URLs:
/api/healthreportsok,db, andschemaastrue./signup.htmlcan create an account./book.htmlcan read availability./admin.htmlopens only for an address inADMIN_EMAILS.
Vercel automatically treats files in api/ as serverless functions. The project currently
has seven API functions. vercel.json also configures security headers, cache behavior,
and legacy URL redirects.
These hosts publish the static frontend only. They do not run the Vercel-shaped functions
in api/, so accounts, bookings, and enquiries stay in each visitor's browser.
Connect the repository to Netlify. netlify.toml already sets:
- Publish directory:
public - A no-op build command
- Redirects for
/about,/book,/reservations, and/register - The response headers in
public/_headers
The workflow in .github/workflows/deploy.yml runs npm ci and npm test, then publishes
public/. Enable GitHub Pages with Source: GitHub Actions. GitHub Pages cannot run the
API or add response headers, so it is suitable for the static mode only.
Set the build output directory to public/ and leave the build command empty. Cloudflare
Pages can use public/_headers, but it cannot run the Vercel functions in api/, so this
is also a frontend-only deployment.
The file path under api/ determines the Vercel route.
| Route | Methods | Description |
|---|---|---|
/api/health |
GET, HEAD |
Reports backend, database, schema, and restaurant time status |
/api/availability?date= |
GET |
Returns available booking slots and the booking horizon |
/api/bookings |
POST, GET, DELETE |
Creates, lists, looks up, and cancels bookings |
/api/enquiries |
POST, GET, PATCH |
Creates enquiries and lets staff list or mark them handled |
/api/auth/signup |
POST |
Creates an account and starts a session |
/api/auth/login |
POST |
Signs in an account |
/api/auth/session |
GET, DELETE |
Reads or ends the current session |
API responses use JSON, Cache-Control: no-store, and a consistent error shape. Write
requests require the same-origin check. Sessions use HttpOnly cookies, and only a
SHA-256 digest of each session token is stored in the database.
lib/schema.sql creates six tables:
| Table | Purpose |
|---|---|
users |
Accounts, names, email addresses, phone numbers, and password hashes |
sessions |
Hashed session tokens and expiry times |
enquiries |
Contact-form messages and handled status |
bookings |
Booking details, references, ownership, and status |
slot_load |
Covers reserved for each service slot |
rate_limits |
Database-backed rate-limit counters |
Bookings are protected by a database constraint that prevents more than 32 covers from being reserved. This guarantee does not depend on a single serverless instance's memory.
Run these commands from the project root.
npm run check
Checks local links, fragments, IDs, labels, images, metadata, CSP-sensitive markup, redirect targets, API route references, and host configuration consistency. It does not need a server or a database.
npm testRuns npm run check and the Node.js test suites. The API tests execute the real handlers
against PGlite, an in-memory PostgreSQL-compatible database, so no external database is
needed for testing. The current suite contains 76 tests across these areas:
test/unit.test.mjs: password hashing, validation, service dates and times, booking slot rules, cookies, same-origin checks, booking references, configuration/schema contracts, and browser/API agreement.test/api.test.mjs: health checks, response headers, routing, authentication and sessions, rate limits, bookings, capacity protection, availability, staff access, enquiries, SQL safety, and session expiry.
The two test files are the authoritative list of individual test cases; the README summarizes their coverage rather than duplicating every test name.
Start the site first:
npm start npm run responsive
The responsive check opens all eight pages at 25 viewport widths, in signed-out and signed-in states. It checks for horizontal overflow and a desktop header that wraps when it should switch to the mobile navigation.
With the site running, and Chrome or Edge installed:
npm run screenshots
Only run this when replacing the source images:
npm run images
This requires Python and Pillow. It reads the ignored media/originals/ directory and
regenerates the optimized JPEG and WebP files in public/assets/img/.
urban-flame/
├── public/ Published website
│ ├── *.html Eight website pages
│ ├── assets/css/ Shared and page-specific stylesheets
│ ├── assets/js/main.js Frontend behavior and local fallback
│ ├── assets/img/ Optimized JPEG and WebP images
│ ├── favicon.svg
│ ├── robots.txt
│ ├── _headers Netlify and Cloudflare Pages headers
│ └── .nojekyll GitHub Pages marker
├── api/ Vercel serverless functions
├── lib/ Database, validation, sessions, and shared API code
├── test/ Unit, contract, and API tests
├── tools/ Local server, database, image, and browser tools
├── docs/screenshots/ README screenshots
├── media/originals/ Ignored source images; never deployed
├── .github/workflows/ GitHub Pages workflow
├── netlify.toml Netlify configuration
├── vercel.json Vercel configuration
├── .env.example Environment variable template
├── package.json Scripts and dependency versions
├── package-lock.json Locked dependency tree
├── LICENSE
└── README.md
public/ is the only directory published as static files. api/ and lib/ run on
Vercel, while tools/, test/, docs/, and media/ stay outside the deployed site.
When no working backend is available, the browser uses these keys:
| Key | Storage | Contents |
|---|---|---|
uf_accounts |
localStorage |
Locally hashed accounts |
uf_session |
localStorage |
Current signed-in email |
uf_bookings |
localStorage |
Local booking records |
uf_messages |
localStorage |
Local enquiries, capped at 50 |
uf_flash |
sessionStorage |
One-time redirect message |
uf_mode |
sessionStorage |
Cached backend availability |
Local mode is not authentication. Anyone with browser developer tools can read or change the data, so use only a throwaway password locally.
Make sure npm ci completed and that npm start is still running. Open
http://localhost:8080, not a file path.
Choose another port and point browser checks at it.
Windows PowerShell:
$env:PORT = 8081 $env:BASE_URL = "http://localhost:8081" npm start
macOS or Linux:
PORT=8081 BASE_URL=http://localhost:8081 npm start
Check that .env exists, that DATABASE_URL or POSTGRES_URL is correct, and that the
database accepts connections from your machine. Managed PostgreSQL providers usually
require TLS in the connection string.
Run npm run db:init with the correct database connection, then restart the server.
Confirm that the signed-in email exactly matches an address in ADMIN_EMAILS, restart the
local server or redeploy Vercel after changing the variable, and make sure the database
schema has been applied.
Install one of those browsers or set CHROME_PATH to its executable. Set BASE_URL if
the site is not running at http://localhost:8080.
- The restaurant, menu, prices, hours, address, phone number, and email are fictional.
- No email provider is connected. Bookings and enquiries are stored, but no email is sent.
- Local mode is limited to one browser and is not authentication.
- The staff page is a convenience interface; server-side staff checks protect the data.
- Payments, deposits, no-show handling, and table-by-table floor plans are not included.
- GitHub Pages and Netlify intentionally provide frontend-only mode without the API.
Guna Rithvick
This project is licensed under the MIT License.





