FERILO uses plain PostgreSQL SQL only (tables, indexes, constraints). No PL/pgSQL functions or triggers — updated_at is handled in the Node.js backend.
Open PowerShell in your project folder (D:\Web_Projects\Ferilo):
docker compose up -dCheck it is running:
docker psYou should see a container named ferilo-db.
Copy .env.example to .env if you have not already.
Use this connection string for Docker:
DATABASE_URL=postgresql://postgres:postgres@localhost:5432/ferilonpm run db:setupThis creates tables, categories, delivery rules, and demo users:
| Password | Role | |
|---|---|---|
admin@ferilo.local |
value of ADMIN_PASSWORD (default testing01) |
ADMIN |
buyer@ferilo.local |
demo1234 |
USER (verified) |
seller@ferilo.local |
demo1234 |
USER (verified) |
You should see:
Database schema applied successfully.Database seeded successfully.
npm run devInvoke-RestMethod http://localhost:5000/api/v1/health
Invoke-RestMethod http://localhost:5000/api/v1/categoriesHealth should show "database": "connected". Categories should return a JSON list.
- Open pgAdmin 4
- Right-click Servers → Register → Server
- General tab → Name:
FERILO Local - Connection tab:
- Host:
localhost - Port:
5432 - Username:
postgres - Password:
postgres - Save password: Yes
- Host:
- Click Save
- Expand:
FERILO Local→Databases→ferilo→Schemas→public→Tables
You can browse categories, users, etc.
docker compose stop # stop
docker compose start # start again
docker compose down # stop and remove container (data kept in volume)If you installed PostgreSQL directly on Windows:
- Open pgAdmin → connect to your local server
- Right-click Databases → Create → Database → name:
ferilo - Set
.env:
DATABASE_URL=postgresql://postgres:YOUR_PASSWORD@localhost:5432/ferilo- Run
npm run db:setup
When you deploy for free, Neon is a good choice: https://neon.tech
- Sign up at https://neon.tech
- Create a project (e.g.
ferilo) - Copy the connection string (looks like):
postgresql://user:password@ep-xxxxx.ap-southeast-1.aws.neon.tech/neondb?sslmode=require
On your host (Railway, Render, etc.) set:
DATABASE_URL=your-neon-connection-stringFrom your PC:
$env:DATABASE_URL="your-neon-connection-string"
npm run db:setupOr use Neon SQL Editor → paste contents of database/schema.sql then database/seed.sql.
Free Neon and Render tiers can sleep when idle. First request may take several seconds.
FERILO includes portfolio offline preview data for:
- Categories, cities, products, featured listings
- Favorites, offers, messages, orders, notifications, reports
- Admin stats / sample users
Behavior:
- Instant: show hardcoded backup data and badge Offline preview — connecting…
- Background: try the live API (8s timeout) and retry periodically
- When API/DB responds: switch to real data and badge Live from database
- Login while offline: any login/register that times out opens a demo session so dashboard pages still work for portfolio demos
Writes (create listing, place order, etc.) are blocked in offline demo mode with a clear message.
| Problem | Fix |
|---|---|
ECONNREFUSED on port 5432 |
Run docker compose up -d or start PostgreSQL service |
password authentication failed |
Check password in DATABASE_URL matches Docker (postgres) or your pgAdmin password |
database "ferilo" does not exist |
Docker creates it automatically; for pgAdmin create it manually |
relation "categories" does not exist |
Run npm run db:setup |
| Categories 503 but health works | Database not running or wrong DATABASE_URL |
docker compose up -d # start database
npm run db:setup # create tables + seed
npm run dev # start website + API
docker compose stop # stop database