Strapi Nextjs Docker Boilerplate

screenshot of Strapi Nextjs Docker Boilerplate
nextjs
strapi

Boilerplate for building Dockerized applications using Strapi v4 + Next.js + Postgres +Nginx

Overview

This package is currently under development and is considered in the beta state. It aims to provide an easy development and production environment, as well as easy adoption of frontend technologies. It is designed for creating full-stack applications for small or medium-sized projects.

Features

  • Backend: Utilizes Strapi v4, Node.js v16 for Docker Image, and Yarn package manager.
  • Frontend: Built with Next.js v12.2, React.js v18.2, Typescript v4.7, Node.js-alpine for Docker Image, and Yarn package manager.
  • Database: Incorporates Postgres v12-alpine, Linux/amd64 platform for platform error on Apple M1 chips, and named volumes.
  • Reverse Proxy: Uses Nginx Latest with fastcgi support and mime-types security configs.
  • Containerization: Implements Docker-compose v3 for container orchestration. Consists of separated Dockerfiles for development and production.
  • Environment Variables Management: One file for backend, frontend, database, and Nginx.

Usage

To build and start the docker-compose file, follow these steps:

  1. Run the command docker-compose up if everything is okay.
  2. Access the Next.js frontend at http://localhost.
  3. Access the Strapi backend (admin) at http://localhost/strapi/admin.
  4. Register with your email and password.
  5. Go to the Content-Type Builder, which has a sample content type named "Article" with three fields: title, body, and cover.
  6. To create a new Article, go to the Content Manager, click on Article in the left pane, then click Create new entry and fill in the details. Finally, click Publish!
  7. To test the API endpoint, you need to give public access to the Article. Go to Settings > User & Permissions Plugin > Roles > Public > Article and select find and findOne. If you need more permissions, select the desired ones and save.
  8. Access the API endpoint at http://localhost/strapi/api/articles.

Security for Endpoints

To secure all your Strapi-related endpoints in Nginx, make sure to use API tokens to connect to the backend and keep this information private. Note that the Nginx configuration provided in the repository is for development purposes and not suitable for production.

Contributing

Contributions are welcome to help shape this package. If interested, please feel free to email the maintainer, Burak, at hello@buraste.com.

Authors

  • Burak Ibis
    • Github: @buraste
    • Twitter: @helloburaste

License

See the LICENSE file for licensing information.

nextjs
Next.js

Next.js is a React-based web framework that enables server-side rendering, static site generation, and other powerful features for building modern web applications.

strapi
Strapi

Strapi is an open source headless CMS that provides a customizable content management system and API for your projects. It allows you to manage content in a visual interface and use a REST or GraphQL API to retrieve the data.

docker
Docker

A website that uses Docker for containerization to streamline development, testing, and deployment workflows. This includes features such as containerization of dependencies, automated builds and deployments, and container orchestration to ensure scalability and availability.