• Stars
    star
    784
  • Rank 55,707 (Top 2 %)
  • Language
    TypeScript
  • License
    MIT License
  • Created about 1 year ago
  • Updated about 2 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Strapi Demo application for Corporate Websites using Next.js

Strapi Starter Next 13, Tailwind, Typescript and Strapi

note: This project was started with love by Trecia, Daniel and Paul. We were all new to Next 13 and Typescript. If you find any bugs or improvements feel free to create an issue. Thank you all for your support and participation.

demo-site

If you prefer videos that guide you therought the setup process you can find them here

Getting Started

  1. Clone the repository locally:
  git clone https://github.com/strapi/nextjs-corporate-starter.git
    or
  gh repo clone strapi/nextjs-corporate-starter
  1. Run setup command to setup frontend and backend dependencies:
  yarn setup
  1. Next, navigate to your /backend directory and set up your .env file. You can use the .env.example file as reference:
HOST=localhost
PORT=1337
APP_KEYS="toBeModified1,toBeModified2"
API_TOKEN_SALT=tobemodified
ADMIN_JWT_SECRET=tobemodified
JWT_SECRET=tobemodified
TRANSFER_TOKEN_SALT=tobemodified
  1. Start your project by running the following command:
  yarn build
  yarn develop

You will be prompted to create your first admin user.

admin-user

Great. You now have your project running. Let's add some data.

Seeding The Data

We are going to use our DEITS feature which will alow to easily import data into your project.

You can learn more about it in our documentation here.

In the root of our project we have our seed-data.tar.gz file. We will use it to seed our data.

  1. Open up your terminal and make sure you are still in you backend folder.

  2. Run the following command to seed your data:

  yarn strapi import -f ../seed-data.tar.gz

after-import

This will import your data locally. Log back into your admin panel to see the newly imported data.

Here is a quick video covering initial setup and data seeding.

seed-data-demo.mp4

Setting Up The Frontend

Next we need to switch to our /frontend directory and create our .env file and paste in the following.

NEXT_PUBLIC_STRAPI_API_TOKEN=your-api-token
NEXT_PUBLIC_PAGE_LIMIT=6
NEXT_PUBLIC_STRAPI_FORM_SUBMISSION_TOKEN=your-form-submission-token
NEXT_PUBLIC_STRAPI_API_URL=http://localhost:1337

Before starting our Next JS app we need to go inside our Strapi Admin and create two tokens that we will be using for form submission and displaying our content.

Inside your Strapi Admin Panel navigate to Settings -> API Tokens and click on the Create new API Token.

api-tokens

Here are our Token Settings

Name: Public API Token Content Description: Access to public content. Token duration: Unlimited Token type: Custom

In Permissions lets give the following access.

Content Permissions
Article find and findOne
Author find and findOne
Category find and findOne
Global find
Page find and findOne
Product-feature find and findOne

permissions

Once you have your token add it to your NEXT_PUBLIC_STRAPI_API_TOKEN variable name in the .env file.

Alternatively: you can create a READ only Token that will give READ permission to all your endpoints.

In this particular project this is not an issue. Although the above is the recommended way, just wanted to show you this option here as well.

When creating a Token, just select the Read-only option from token type drop down.

create-read-only-token

Next create a token that will allow us to submit our form.

Name: Public API Form Submit Description: Form Submission. Token duration: Unlimited Token type: Custom

In Permissions lets give the following access.

Content Permissions
Lead-Form-Submission create

Add your token to your NEXT_PUBLIC_STRAPI_FORM_SUBMISSION_TOKEN variable name in the .env file.

Once your environment variables are set you can start your frontend application by running yarn dev.

You should now see your Next JS frontend.

frontend

Start Both Projects Concurrently

We can also start both projects with one command using the concurrently package.

You can find the setting inside the package.json file inside the root folder.

{
  "scripts": {
    "frontend": "yarn dev --prefix ../frontend/",
    "backend": "yarn dev --prefix ../backend/",
    "clear": "cd frontend && rm -rf .next && rm -rf cache",
    "setup:frontend": "cd frontend && yarn",
    "setup:backend": "cd backend && yarn",
    "setup": "yarn install && yarn setup:frontend && yarn setup:backend",
    "dev": "yarn clear && concurrently \"cd frontend && yarn dev\" \"cd backend && yarn develop\""
  },
  "dependencies": {
    "concurrently": "^7.6.0"
  }
}

You can start both apps by running yarn dev.

Conclusion

Hope you find this starter useful, it is a bare-bone example to help you get started quickly.

Would love to hear what you will build using it.

If you find bugs or have suggestions feel free to create issues.

Thank you and stay awesome.

Contributing to the Next.js Corporate Starter repository

We're so excited that you're thinking about contributing to the Next.js Corporate Starter open-source project! If you're unsure or afraid of anything, just know that you can't mess up here. Any contribution is valuable, and we appreciate you!

This document aims to provide all the necessary information for you to make a contribution.

Prerequisites

Before you can contribute, you need to have the following installed:

  • Node.js and npm: You can download these from the official Node.js website.
  • Git: You can find installation instructions for Git in the official Git Book.

Steps to Contribute

1. Fork the Repository

In your web browser, navigate to https://github.com/strapi/nextjs-corporate-starter. Click the 'Fork' button in the upper right-hand corner of the page. This creates a copy of the repository in your GitHub account.

2. Clone your Fork

Now, go to your version of the repository. You can do this by navigating to https://github.com/USERNAME/nextjs-corporate-starter (replace 'USERNAME' with your GitHub username). Here, click the 'Clone' button and then 'Copy to clipboard' to copy the git URL.

Next, you need to open your terminal, navigate to where you want to store the project, and type the following command, followed by 'Enter':

git clone PASTE_CLONED_REPOSITORY_URL

Replace 'PASTE_CLONED_REPOSITORY_URL' with the URL you copied earlier. This command downloads your fork to your computer.

3. Add Upstream Repository

Before you can start contributing, you have to set up a reference to the original repository. You can do this with the following command:

git remote add upstream https://github.com/strapi/nextjs-corporate-starter.git

This command adds a new remote, named 'upstream', that points to the original repository.

4. Synchronize your Fork

Before you start making changes, you should synchronize your forked repository with the latest changes from the upstream. Here are the steps:

a. Fetch the branches and their respective commits:

git fetch upstream

b. Checkout to the main branch of your fork:

git checkout main

c. Merge changes from the upstream's main branch into your local main branch:

git merge upstream/main

This brings your fork's main branch into sync with the upstream repository, without losing your local changes.

5. Create a Branch

When you're making a contribution, it's best to make your changes in a new branch instead of the main branch. You can create a new branch and switch to it using the following command:

git checkout -b BRANCH_NAME

Replace 'BRANCH_NAME' with a name that describes the change you're planning to make.

6. Make your Changes

Now, you can start making changes to the project. Feel free to make changes that you think will enhance the project.

7. Commit your Changes

When you've made your changes, you need to commit them. This is like creating a save point in a game. You can do this using the following commands:

git add -A
git commit -m "Your detailed commit message"

Replace "Your detailed commit message" with a description of the changes you made.

8. Push your Changes

After committing your changes, you need to push them to your forked repository on GitHub. You can do this with the following command:

git push origin BRANCH_NAME

Replace 'BRANCH_NAME' with the name of the branch you created earlier.

9. Create a Pull Request

After you've pushed your changes, you're ready to create a pull request (PR). Navigate to your forked repository in your web browser and click on 'Pull request' (near the top of the page), then on 'New pull request'. Ensure that the base fork is the original repository and the base is 'main', and that the head fork is your fork and the compare is the branch you created.

Enter a title for your PR and describe the changes you made. Once you're ready, click 'Create pull request'.

Congrats! 🎉

You've just made a contribution to the Next.js Corporate Starter project! The team will review your changes and may suggest some modifications or improvements. Once your changes have been approved, they will be merged into the main codebase.

Thank you for your contribution. We appreciate you!

Remember, everyone was new to open-source at some point. If you're unsure about something, don't hesitate to ask for help. Good luck and happy hacking!

Psst...

If you find yourself contributing frequently, we've provided a script in the package.json to help keep your local project synchronized with the main branch of the upstream (original) project. Simply execute the following command:

yarn repo:upstream

FAQ

How do I add additional pages?

Check out this video where I will guide on how to do this.

How do I update my Strapi version?

Check out this this issue comment

More Repositories

1

strapi

🚀 Strapi is the leading open-source headless CMS. It’s 100% JavaScript/TypeScript, fully customizable and developer-first.
TypeScript
59,511
star
2

strapi-examples

🎓 List of examples using Strapi
1,339
star
3

strapi-docker

Install and run your first Strapi project using Docker
JavaScript
1,153
star
4

foodadvisor

🥘 THE Strapi demo application
JavaScript
1,017
star
5

documentation

Strapi Documentation
JavaScript
917
star
6

community-content

Contribute and collaborate on educational content for the Strapi Community
JavaScript
562
star
7

buffet

Buffet.js — React Components Library made with styled-components
JavaScript
536
star
8

design-system

Strapi.io's design system 🚀
TypeScript
412
star
9

strapi-starter-next-blog

Strapi Starter Next Blog
JavaScript
377
star
10

strapi-starter-next-corporate

Next.js starter for creating a corporate site with Strapi.
JavaScript
344
star
11

starters-and-templates

Monorepo for all official Strapi v4 templates
JavaScript
308
star
12

strapi-sdk-javascript

🔌 Official JavaScript SDK for APIs built with Strapi.
TypeScript
270
star
13

strapi-starter-next-ecommerce

Strapi Starter Next.js E-commerce
JavaScript
210
star
14

strapi-starter-nuxt-blog

Strapi Starter Nuxt Blog
Vue
181
star
15

strapi-starter-nuxt-e-commerce

Strapi Starter Nuxt.js E-commerce
Vue
177
star
16

strapi-starter-gatsby-blog

Updated version of the first Gatsby starter with much more features
JavaScript
139
star
17

strapi-starter-react-blog

Strapi Starter React Blog
JavaScript
120
star
18

strapi-legacy-gatsby-blog

Strapi Starter Gatsby Blog
JavaScript
101
star
19

strapi-legacy-blog

Starter for creating a simple blog with Strapi.
JavaScript
96
star
20

strapi-heroku-template

Strapi official template for Heroku 1 click deploy button
JavaScript
93
star
21

strapi-template-corporate

Template to create Strapi projects pre-configured for corporate sites
JavaScript
83
star
22

strapi-plugin-seo

The official plugin to make your Strapi content SEO friendly
JavaScript
81
star
23

rfcs

RFCs for Strapi future changes
69
star
24

waterline-graphql

GraphQL adapter for the Waterline ORM.
JavaScript
69
star
25

strapi-starter-angular-blog

Strapi Starter Angular Blog
TypeScript
66
star
26

strapi-starter-vue-blog

Strapi Starter Vue Blog
Vue
64
star
27

strapi-next-14-dashboard-demo

TypeScript
60
star
28

strapi-template-blog

Template to create Strapi projects pre-configured for blogs
JavaScript
60
star
29

strapi-template-ecommerce

Template to create Strapi projects pre-configured for e-commerce apps
JavaScript
58
star
30

migration-scripts

Collection of Strapi Migration scripts
JavaScript
57
star
31

blocks-react-renderer

A React renderer for the Strapi's Blocks rich text editor
TypeScript
57
star
32

one-click-deploy

Shell
56
star
33

codemods

A set of scripts to help migrate Strapi plugins (and in some cases Strapi applications) from v3 to v4
JavaScript
42
star
34

strapi-heroku-cms-demo

Repository for "CMS" from the Gatsby / Strapi Video Tuturial Series
JavaScript
35
star
35

strapi-starter-gridsome-blog

Build blog sites using Strapi and Gridsome
Vue
32
star
36

strapi-starter-gridsome-portfolio

Build portfolio sites using Strapi and Gridsome
Vue
32
star
37

strapi-starter-gatsby-catalog

Strapi Starter Gatsby Catalog
JavaScript
27
star
38

strapi-starter-gatsby-corporate

JavaScript
26
star
39

strapi-docs

The Strapi documentation.
24
star
40

strapi-template-event-vercel

Template to create Strapi projects pre-configured for event using the Vercel Event kit
JavaScript
22
star
41

strapi-conf-next-template

TypeScript
20
star
42

strapi-plugin-open-ai

The official plugin that allows you to create Open AI completion from a prompt
JavaScript
16
star
43

strapi-meetups

Learn, share and collaborate with the community at Strapi meetups. Contributions welcome.
15
star
44

bookshelf-cache-redis

🔥 A robust, performance-focused caching solution for Bookshelf based on top of Redis.
JavaScript
15
star
45

strapi-studio

The official open-source repository of the Strapi Studio.
12
star
46

strapi-generate-admin

Generate the default admin panel inside your Strapi application.
JavaScript
12
star
47

community-resources

Explore and learn a diverse range of ways to contribute to the Strapi Community
11
star
48

strapi-conf-admin-template

Template for the StrapiConf Admin
JavaScript
10
star
49

strapi-template-portfolio

Template to create Strapi projects pre-configured for portfolio sites
JavaScript
10
star
50

strapi-plugin-gatsby-preview

JavaScript
9
star
51

components

Official Strapi components library
9
star
52

strapi-generate-users

Generate user features for your Strapi application.
JavaScript
8
star
53

strapi-generate-upload

Generate the default upload features for a Strapi application.
JavaScript
6
star
54

strapi-generate-email

Generate the default email features for a Strapi application.
JavaScript
6
star
55

eslint-config

Strapi eslint config
JavaScript
6
star
56

strapi-template-next-example

JavaScript
5
star
57

.github

Community health files for the @strapi organization
4
star
58

strapi-template-catalog

JavaScript
4
star
59

strapi-settings-manager

Strapi plugin built to let you easily configure your Strapi applications.
JavaScript
3
star
60

best-practices-samples

Sample project code for Strapi Best Practice calls
JavaScript
3
star
61

security-patches

Patch-package patches for TID2212
2
star
62

plugin-rfc-examples

JavaScript
2
star
63

strapi-generate

JavaScript
2
star
64

strapi-generate-api

JavaScript
2
star
65

strapi-generate-new

JavaScript
2
star
66

javascript

Strapi Javascript Style Guide
1
star
67

foodadvisor-migration-example

JavaScript
1
star
68

internal-lms

Strapi's Internal Learning Management System
JavaScript
1
star
69

strapi-cloud-template-blog

JavaScript
1
star