Skip to content

upayanmazumder-DevLabs/next-strapi-postgres-template

Repository files navigation

Next-Strapi-Postgres-Template

Full-stack web application template featuring Next.js frontend, Strapi CMS admin/backend, and PostgreSQL database.

This template provides a clean, scalable structure for building modern web projects with a headless CMS and optional custom backend logic.


Features

  • Frontend (Next.js)

    • Public-facing website with SSR/SSG support
    • Tailwind CSS for styling
    • API integration with Strapi and custom backend
  • Backend (Custom Node.js)

    • Optional business logic
    • REST API endpoints
    • PostgreSQL models and database integration
    • Authentication and authorization support
  • Admin (Strapi)

    • Content management dashboard
    • Role-based access control
    • Custom content-types (products, blogs, pages, etc.)
  • Database (PostgreSQL)

    • Relational database for Strapi CMS content
    • Can also store custom backend data

Repo Structure


next-strapi-postgres-template/
├── frontend/          # Next.js frontend
├── backend/           # Custom Node.js backend
├── strapi/            # Strapi CMS / admin portal
├── package.json       # Optional root package.json for monorepo
└── README.md


Getting Started

Prerequisites

  • Node.js (v18+)
  • npm or yarn
  • PostgreSQL database
  • (Optional) Docker for local development

Setup Strapi (Admin/CMS)

  1. Navigate to the strapi folder:
cd strapi
  1. Install dependencies:
npm install
  1. Configure PostgreSQL in .env or config/database.js:
DATABASE_HOST=localhost
DATABASE_PORT=5432
DATABASE_NAME=mydb
DATABASE_USERNAME=myuser
DATABASE_PASSWORD=mypassword
  1. Start Strapi:
npm run develop

Admin panel available at: http://localhost:1337/admin


Setup Custom Backend (Optional)

  1. Navigate to the backend folder:
cd backend
  1. Install dependencies:
npm install
  1. Configure PostgreSQL connection in .env:
DB_HOST=localhost
DB_PORT=5432
DB_NAME=mydb
DB_USER=myuser
DB_PASSWORD=mypassword
  1. Start backend:
npm run dev

Setup Frontend

  1. Navigate to the frontend folder:
cd frontend
  1. Install dependencies:
npm install
  1. Configure API endpoints in .env:
NEXT_PUBLIC_STRAPI_URL=http://localhost:1337
NEXT_PUBLIC_BACKEND_URL=http://localhost:5000
  1. Start frontend:
npm run dev

Frontend available at: http://localhost:3000


Deployment Recommendations

  • Frontend: Vercel / Netlify
  • Strapi: Render / Railway / self-hosted server with PostgreSQL
  • Backend: Render / Railway / AWS / DigitalOcean

Contributing

This template is designed to be reusable for any project. Feel free to:

  • Add new content-types in Strapi
  • Extend custom backend with new APIs
  • Customize frontend components and pages

License

MIT License

About

Full-stack web application template featuring Next.js frontend, Strapi CMS admin/backend, and PostgreSQL database.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages