Giter Site home page Giter Site logo

jrgarciadev / nextjs-strapi-slider Goto Github PK

View Code? Open in Web Editor NEW
5.0 1.0 0.0 10.96 MB

Slider made with GSAP, Next.js, Strapi and GraphQL

Home Page: https://nextjs-gsap-slider.vercel.app/

Shell 1.54% JavaScript 15.45% TypeScript 83.02%
nextjs strapi graphql typescript

nextjs-strapi-slider's Introduction

A statically generated image slides using GSAP, Next.js and Strapi CMS

Frontend URL

https://nextjs-gsap-slider.vercel.app/

Strapi CMS URL

https://wild-slider-cms.herokuapp.com/

GRAPHQL URL

https://wild-slider-cms.herokuapp.com/graphql

Step 1. Set up Strapi enviroment

On wild-slider-cms

Execute

cp .env.example .env

You must have a Mongodb.com account and AWS S3 Bucket Set up your .env

  • DATABASE_URI=mongodb+srv://<user>:<password>@cluster0.vbxof.mongodb.net/<dbname>?retryWrites=true&w=majority
  • DATABASE_URI=YOUR_MONGO_DATABASE_URI
  • DATABASE_NAME=YOUR_DATABASE_NAME
  • AWS_API_ID=YOUR_AWS_S3_ID
  • AWS_API_KEY=YOUR_AWS_S3_KEY
  • AWS_API_REGION=YOUR_AWS_API_REGION
  • AWS_BUCKET_NAME=YOUR_AWS_BUCKET_NAME

Step 2. Set up Strapi locally

Execute

cd wild-slider-cms
yarn # or: npm run install
yarn develop  # or: npm run develop

This will open http://localhost:1337/ and prompt you to create an admin user.

Step 3. Create a Entries data

From Content-Types, Entries.

  • Click on button Add new entries.

  • Click on cover image and upload assets from slider folder

  • Select an Image for entry

  • Write a caption and press Save and Publish button

  • Repeat this 3 times for others Images

Step 4. Set permissions

From Settings & Roles, edit the Public role.

Then select: count, find, and findone permissions for Entries. Click Save.

Step 5. Set up environment variables

While the Strapi server is running, open a new terminal and cd into the Next.js app directory you created earlier.

cd wild-slider-frontend

Copy the .env.local.example file in this directory to .env.local (which will be ignored by Git):

cp .env.local.example .env.local

Then set each variable on .env.local:

  • STRAPI_PREVIEW_SECRET can be any random string (but avoid spaces), like MY_SECRET - this is used for Preview Mode.
  • NEXT_PUBLIC_STRAPI_API_URL should be set as http://localhost:1337 (no trailing slash).
  • NEXT_PUBLIC_STRAPI_API_URL_GRAPHQL should be set as http://localhost:1337/graphql (no trailing slash).

Step 6. Run Next.js in development mode

Make sure that the local Strapi server is still running at http://localhost:1337. Inside the Next.js app directory, run:

npm install
npm run dev

# or

yarn install
yarn dev

Your wild-slider application should be up and running on http://localhost:3000! You should see the 4 entries you’ve created. If it doesn't work, make sure that:

  • You’ve set the Roles & Permissions in Step 4.
  • You’ve clicked on "Publish" in Step 3

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.