sesto-dev / next-prisma-tailwind-ecommerce

✨ Open-Source Full-stack E-Commerce Storefront with CMS Admin Panel. Built with Typescript, Next.js 14 App Dir, Tailwind CSS ( @shadcn-ui ) and Prisma. Admin Panel: https://pardis.vercel.app
https://pasargad.vercel.app
MIT License
219 stars 33 forks source link
authentication ecommerce email full-stack httponly-cookie next-themes nextjs nodejs postgresql prisma react react-server-components server-side-rendering serverless shadcn shadcn-ui tailwindcss typescript

Screenshot

Full-Stack E-Commerce Platform

Built using Typescript with Next.js, Prisma ORM and TailwindCSS.

Storefront Β· Admin Panel

πŸ‘‹ Introduction

Welcome to the open-source Next.js E-Commerce Storefront with Admin Panel project! This project is built with TypeScript, Tailwind CSS, and Prisma, providing a powerful and flexible solution for building and managing your e-commerce website.

πŸ₯‚ Features

2️⃣ Why are there 2 apps in the app folder?

This project is made up of 2 separate apps ( admin and storefront ) which should be deployed separately. If you are deploying with Vercel you should create 2 different apps.

image

Under the general tab there is a Root Directory option, for the admin app you should put in "apps/admin" and for the storefront app you should put in "apps/storefront".

πŸ” Authentication

The authentication is handled using JWT tokens stored in cookies and verified inside the middleware.ts file. The middleware function takes in the HTTP request, reads the token cookie and if the JWT is successfully verified, it sets the X-USER-ID header with the userId as the value, otherwise the request is sent back with 401 status.

πŸ‘β€πŸ—¨ Environment variables

Environment variables are stored in .env files. By default the .env.example file is included in source control and contains settings and defaults to get the app running. Any secrets or local overrides of these values should be placed in a .env file, which is ignored from source control.

Remember, never commit and store .env in the source control, just only .env.example without any data specified.

You can read more about environment variables here.

πŸƒβ€β™‚οΈ Getting Started Locally

Clone the repository.

git clone https://github.com/sesto-dev/next-prisma-tailwind-ecommerce

Navigate to each folder in the apps folder and and set the variables.

cp .env.example .env

Get all dependencies sorted.

bun install

Bring your database to life with pushing the database schema.

bun run db:push
bun run dev

πŸ”‘ Database

Prisma ORM can use any PostgreSQL database. Supabase is the easiest to work with. Simply set DATABASE_URL in your .env file to work.

bun run db

This project exposes a package.json script for accessing prisma via bun run db:<command>. You should always try to use this script when interacting with prisma locally.

Making changes to the database schema

Make changes to your database by modifying prisma/schema.prisma.

πŸ›Έ How to Deploy the Project

Follow the deployment guides for Vercel, Netlify and Docker for more information.

πŸ“„ License

This project is MIT-licensed and is free to use and modify for your own projects. Check the LICENSE file for details.

Created by Amirhossein Mohammadi.