A responsive one-page corporate/agency template with an admin panel and PostgreSQL backend. Content (hero, team, portfolio, testimonials, blog, etc.) is stored in the database and editable via the admin; the same app runs locally or on Netlify as a serverless function.
- Responsive design – Bootstrap 3, works on all screen sizes
- Database-driven content – Hero slides, team, work, testimonials, blog, pricing, contact
- Admin panel – Edit all content at
/admin(login required) - Static assets – Images, CSS, and JS served from
/assets(CDN on Netlify) - Netlify-ready – Full backend runs as a serverless function; images and assets served from the publish directory
- Frontend: HTML (EJS), Bootstrap 5, jQuery, Owl Carousel, Magnific Popup
- Backend: Node.js, Express, EJS, express-session
- Database: PostgreSQL
- Deploy: Netlify (Functions + static publish)
Follow these steps to run the project on your machine.
git clone https://github.com/pras75299/One-page-Corporate-Template.git
cd One-page-Corporate-Template
npm installCopy the example env file and edit it:
cp .env.example .envEdit .env and set:
| Variable | Description |
|---|---|
DATABASE_URL |
PostgreSQL connection string (e.g. postgresql://user:password@localhost:5432/corporate_template) |
SESSION_SECRET |
Random string for admin sessions (use a long random value in production) |
ADMIN_PASSWORD |
Password for the admin user (used when you run the seed; set before seeding) |
Example:
DATABASE_URL=postgresql://user:password@localhost:5432/corporate_template
SESSION_SECRET=your-secret-key-change-in-production
ADMIN_PASSWORD=your-secure-passwordCreate the schema and seed default content (and the admin user):
npm run init-db # Creates tables
npm run seed # Inserts default content + admin user (uses ADMIN_PASSWORD from .env)npm start- Site: http://localhost:3000
- Admin: http://localhost:3000/admin (login:
admin/ password fromADMIN_PASSWORD)
You can open the static index.html in a browser for a quick look. It uses hardcoded content and relative asset paths; for full content editing and production-like behavior, use the Node/Express setup above.
The repo is configured so the entire backend runs as a Netlify serverless function. The home page is rendered from the database on each request; the admin panel is at /admin. Images and other assets (/assets/*) are served from the publish directory so they load quickly from the CDN.
- Build command:
cp -r assets public/assets
(This copies images, CSS, and JS into the publish directory so Netlify can serve them at/assets/*.) - Publish directory:
public - Functions directory:
netlify/functions
In Site settings → Environment variables, add:
| Variable | Description |
|---|---|
DATABASE_URL |
PostgreSQL connection string for your production database |
SESSION_SECRET |
Long random string for admin sessions |
ADMIN_PASSWORD |
Optional; only needed if you seed the production DB (set before running seed against that DB) |
From your machine, point .env at the production database (the same DATABASE_URL as in Netlify), then run:
npm run init-db # Create tables
npm run seed # Insert default content and admin userAfter that, the Netlify site will use that database; changes in the admin will appear on the next page load.
- Redirects (in
netlify.toml): Requests to/assets/* are served from the publish directory (images, CSS, JS). All other routes go to the Express app via/.netlify/functions/server. - Images: Stored under
assets/img/(team, work, testimonials, blog, etc.). The build copies them intopublic/assets/so they are available at/assets/img/.... The app also normalizes image URLs (with or without a leading slash) so they work everywhere.
| Command | Description |
|---|---|
npm start |
Run the Express server (default port 3000) |
npm run init-db |
Create PostgreSQL tables from server/schema.sql |
npm run seed |
Seed default content and create admin user |
├── app.js # Express app (routes, static, views)
├── server.js # Local entry (starts app on a port)
├── server/
│ ├── schema.sql # DB schema
│ ├── seed.js # Seed data + admin user
│ ├── db.js # DB connection + getSiteContent()
│ ├── routes/ # public + admin routes
│ └── ...
├── views/ # EJS templates (home, admin, partials)
├── assets/ # Images, CSS, JS (copied to public/assets on Netlify build)
│ ├── img/
│ ├── css/
│ └── js/
├── public/ # Netlify publish dir (assets copied here during build)
├── netlify/
│ └── functions/
│ └── server.js # Netlify function entry (wraps app)
└── netlify.toml # Build + redirects (assets first, then function)
Use and modify as needed for your project.