Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
c64fbd1
Set up Prisma 5 with MySQL at Planetscale
commitwiz Oct 10, 2023
1f4d0e1
Merge pull request #1 from pjborowiecki/main
commitwiz Oct 21, 2023
4ebcb43
Update .env.example and README
commitwiz Oct 21, 2023
81b1b61
Update README and .env.example
commitwiz Oct 21, 2023
ecc1837
Configure PlanetScale MySQL database connection, define databas schem…
commitwiz Oct 21, 2023
e3c08e3
Update README, db scripts and database schema
commitwiz Oct 21, 2023
4565639
Optimize prisma schema for PlanetScale MySQL database
commitwiz Oct 21, 2023
15be976
Update README
commitwiz Oct 21, 2023
54efc60
Remove Prisma
commitwiz Oct 21, 2023
c5ed8c8
Set up Neon connection, configure drizzle, add initial auth database …
commitwiz Oct 22, 2023
34f2c08
Update schemas and add relations; update package.json scripts, append…
commitwiz Oct 22, 2023
4c13aa3
Update schema to add additional indices; define prepared statements r…
commitwiz Oct 22, 2023
181e79a
Work in progress; switching from prisma to drizzle
commitwiz Oct 23, 2023
6af6390
Work in progress; switching from Prisma to Drizzle
commitwiz Oct 23, 2023
04b2cb1
Replace Prisma with Drizzle ORM; work in progress
commitwiz Oct 23, 2023
9434e9c
Switch from Prisma to Drizzle; work in progress
commitwiz Oct 23, 2023
9512c65
Update README
commitwiz Oct 24, 2023
a0571b8
Update README
commitwiz Oct 24, 2023
c200eda
Update server actions
commitwiz Oct 24, 2023
d9c1668
Update configuration; upgrade to Next 14; add blog with Contentlayer …
commitwiz Nov 11, 2023
d92ef3e
Update README
commitwiz Nov 11, 2023
cef6b05
Minor refactor
commitwiz Nov 11, 2023
1163dd6
Upgrade to Next-Auth v.5; improve server-side input validation; mino…
commitwiz Feb 20, 2024
ccd9e2c
Update packages; update ES Lint, TS, Prettier, and Drizzle configuration
commitwiz May 9, 2024
6eca047
Enable role-based authentication; fix next-auth deprecation warnings;…
commitwiz May 9, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 14 additions & 12 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,23 @@
NODE_ENV="development"
NEXT_PUBLIC_APP_URL="https://localhost:3000"

# DATABASE (POSTGRES @ NEON)
# Ensure to append `?sslmode=require` at the end of your connection string
DATABASE_URL=""

# AUTHENTICATION (@ NEXT-AUTH)
# Secret can be generated with `openssl rand -base64 32`
# Follow instructions at https://codevoweb.com/nextjs-add-google-and-github-oauth2-using-nextauth-js/ to obtain client ids and secrets
NEXTAUTH_URL=""
AUTH_SECRET=""
JWT_SECRET_KEY=""
AUTH_GOOGLE_ID=""
AUTH_GOOGLE_SECRET=""
AUTH_GITHUB_ID=""
AUTH_GITHUB_SECRET=""


# DATABASE (POSTGRES @ NEON)
# Ensure you append `sslmode=required` after the question mark in your connection string
DATABASE_URL=""

GOOGLE_ID=""
GOOGLE_SECRET=""
GITHUB_ID=""
GITHUB_SECRET=""

# EMAIL (@ RESEND)
RESEND_API_KEY=""
RESEND_EMAIL_FROM=""
RESEND_EMAIL_TO=""
RESEND_HOST="smtp.resend.com"
RESEND_USERNAME="resend"
RESEND_PORT="465"
5 changes: 5 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.next/
node_modules/
coverage/
package-lock.json
pacakge-lock.yaml
37 changes: 0 additions & 37 deletions .eslintrc.cjs

This file was deleted.

35 changes: 35 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/** @type {import("eslint").Linter.Config} */
{
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": true
},
"plugins": ["@typescript-eslint", "tailwindcss"],
"extends": [
"next/core-web-vitals",
"plugin:@typescript-eslint/recommended-type-checked",
"plugin:tailwindcss/recommended",
"prettier"
],
"rules": {
"@typescript-eslint/consistent-type-imports": [
"warn",
{
"prefer": "type-imports",
"fixStyle": "inline-type-imports"
}
],
"@typescript-eslint/no-unused-vars": ["warn", { "argsIgnorePattern": "^_" }],
"@next/next/no-img-element": "off"
},
"settings": {
"next": {
"rootDir": ["./"]
},
"tailwindcss": {
"callees": ["cn", "cva"],
"config": "./tailwind.config.ts",
"classRegex": "^(class(Name)?|tw)$"
}
}
}
8 changes: 7 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,10 @@ yarn-error.log*
next-env.d.ts

# certificates
certificates
certificates

# content
.contentlayer

# notes
TODO.md
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v20.10.0
39 changes: 39 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"endOfLine": "lf",
"semi": false,
"singleQuote": false,
"tabWidth": 2,
"trailingComma": "es5",
"importOrder": [
"^@/styles/(.*)$",
"",
"^(react/(.*)$)|^(react$)",
"^(next/(.*)$)|^(next$)",
"<THIRD_PARTY_MODULES>",
"",
"^@/env.mjs",
"^types$",
"^@/types/(.*)$",
"^@/config/(.*)$",
"^@/db/(.*)$",
"^@/validations/(.*)$",
"^@/data/(.*)$",
"",
"^@/providers/(.*)$",
"^@/hooks/(.*)$",
"^@/lib/(.*)$",
"",
"^@/components/ui/(.*)$",
"^@/components/(.*)$",
"^@/app/(.*)$",
"",
"^[./]"
],
"importOrderParserPlugins": ["typescript", "jsx", "decorators-legacy"],
"tailwindAttributes": ["tw"],
"tailwindFunctions": ["cva"],
"plugins": [
"@ianvs/prettier-plugin-sort-imports",
"prettier-plugin-tailwindcss"
]
}
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# MIT License

Copyright (c) 2023 Sadman Sakib
Copyright (c) 2023 Piotr Borowiecki

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
112 changes: 42 additions & 70 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,87 +1,59 @@
# [Next 13 starters with authentication and database set up](https://saasyland.com)
# [Next 14 starters with authentication and database set up](https://saasyland.com)

Starter templates for Next.js 13 full-stack projects. Built with Tailwind CSS, ShadCn, authentication, and database. Several branches contain several different configurations, including serverless databases like PostgreSQL with Neon, or MySQL with PlanetScale, Drizzle ORM, Prisma ORM v.5 (serverless-compatible), but also MongoDB and Supabase. The project is written in TypeScript, styled with [Tailwind CSS](https://tailwindcss.com) and [ShadCn](https://shadcn.com). All users are stored in a database, regardless of whether they signed up with email and password, magic link, or via an OAuth provider.
#### See the live demo [here](https://saasyland.com)

**The project is currently under active development. Please check back soon**
## Description:

![public/images/screenshots/screenshot_1](./public/images/screenshots/screenshot_1.png)

![public/images/screenshots/screenshot_2](./public/images/screenshots/screenshot_2.png)

![public/images/screenshots/screenshot_3](./public/images/screenshots/screenshot_3.png)

![public/images/screenshots/screenshot_3](./public/images/screenshots/screenshot_4.png)

## Available configurations:

- ### [next-auth-drizzle-neon-postgres](https://github.com/pjborowiecki/SAASY-LAND-Next-13-Starters-With-Authentication-And-Database-Implemented/tree/next-auth-drizzle-planetscale-mysql)

Under construction

- ### [next-auth-drizzle-planetscale-mysql](https://github.com/pjborowiecki/SAASY-LAND-Next-13-Starters-With-Authentication-And-Database-Implemented/tree/next-auth-drizzle-planetscale-mysql)

Under construction

- ### [next-auth-prisma5-serverless-neon-postgres](https://github.com/pjborowiecki/SAASY-LAND-Next-13-Starters-With-Authentication-And-Database-Implemented/tree/next-auth-prisma5-serverless-neon-postgres)
Starter templates for [Next.js 14](https://nextjs.org/) full-stack projects. Built with [TypeScript](https://www.typescriptlang.org/), [Tailwind CSS](https://tailwindcss.com/), [ShadCn/ui](https://ui.shadcn.com/), authentication, and database. Several branches contain several different configurations, including serverless databases like PostgreSQL with [Neon](https://neon.tech), or MySQL with [PlanetScale](https://planetscale.com), [Drizzle ORM](https://orm.drizzle.team/), [Prisma ORM v.5](https://www.prisma.io/) (serverless-compatible), but also [MongoDB Atlas](https://www.mongodb.com/atlas/database), [Supabase](https://supabase.com/), and even [Nest.js](https://nestjs.com/), [Express (MERN stack)](https://expressjs.com/), or [Django](https://www.djangoproject.com/). All users are stored in a database, regardless of whether they signed up with email and password, magic link, or via an OAuth provider.

This branch contains a Next.js 13 starter with Next-Auth authentication using JSON Web Tokens (JWT), and a PostgreSQL database set up at [Neon](https://neon.tech). The database is connected via [Prisma](https://prisma.io) v.5, which is serverless-compatible. OAuth authentication is also set up for GitHub and Google. The set up contains email verification and password reset functionality, both set up with [Resend](https://resend.com) and [React Email](https://react.email/).
### PostgreSQL at [Neon](https://neon.tech) with [Drizzle](https://orm.drizzle.team)

- ##### TODO:
This branch contains a Next.js 14 starter with Next-Auth authentication using JSON Web Tokens (JWT), and a PostgreSQL database set up at [Neon](https://neon.tech). The database is connected with [Drizzle ORM](https://orm.drizzle.team/), which is serverless-compatible. OAuth authentication is also set up for GitHub and Google providers. **This branch takes advantage of [prepared statements](https://orm.drizzle.team/docs/perf-queries), which are designed to massively improve query performance.** The set up contains email verification and password reset functionality, both set up with [Resend](https://resend.com) and [React Email](https://react.email/).

- [x] Implement sign up with email and password
- [x] Implement sign in with email and password
- [x] Implement sign out functionality
- [x] Set up OAuth sign in with GitHub and Google
- [x] Set up email verification
- [x] Set up password reset
- [x] Set up sign in with magic link
- [x] Improve email templates with [React Email](https://react.email/)
- [x] Fix linting warnings
- [ ] Set up a user profile page with a form to update user information
- [ ] Set up file upload for user profile pictures
- [ ] Complete the landing page sections and footer
- [ ] Add terms of service and privacy policy pages
- [ ] Set up a newsletter sign up
- [ ] Add contact form
- [ ] Implement payments with [Stripe](https://stripe.com)
- [ ] Set up blogging with Markdown and MDX (or [Payload 2](https://payloadcms.com/) and [Lexical](https://lexical.dev/))
<br />

- ### [next-auth-prisma5-serverless-planetscale-mysql](https://github.com/pjborowiecki/SAASY-LAND-Next-13-Starters-With-Authentication-And-Database-Implemented/tree/next-auth-prisma5-serverless-planetscale-mysql)
> **Warning**
> This project is still in active development. Please see the list below to get a better understanding of what feature have been implemented already and what is yet to come.

Under construction
<br />

- ### [next-auth-docker-local-postgres-drizzle](https://github.com/pjborowiecki/SAASY-LAND-Next-13-Starters-With-Authentication-And-Database-Implemented/tree/next-auth-docker-local-postgres-drizzle)
## Features:

Under construction
- [x] Authentication with NextAuth
- [x] Database and ORM set up
- [x] Magic link authentication
- [x] OAuth authentication
- [x] Email and password authentication
- [x] Email verification
- [x] Password reset
- [x] Email templates with React Email
- [x] Functional contact form
- [x] Functional newsletter sign up
- [x] Functional blog with Contentlayer and MDX
- [x] Functional and styled landing page with pricing, features, testimonials, and FAQ sections
- [x] Functional and styled sign in and sign up pages
- [x] Input validation with Zod
- [x] Rigorous linting and TypeScript type checking

- ### [next-auth-docker-local-postgres-prisma](https://github.com/pjborowiecki/SAASY-LAND-Next-13-Starters-With-Authentication-And-Database-Implemented/tree/next-auth-docker-local-postgres-prisma)
<br />

Under construction
- [ ] Documentation pages
- [ ] Stripe payments integration
- [ ] Opt out from newsletter
- [ ] User profile and settings pages
- [ ] Custom loading pages with skeleton loaders
- [ ] Custom error pages
- [ ] Add pages for menu items
- [ ] Improve MDX blog styling
- [ ] Improve performance and make Edge compatible
- [ ] Add tests

- ### [next-auth-mongoose-mongodb](https://github.com/pjborowiecki/SAASY-LAND-Next-13-Starters-With-Authentication-And-Database-Implemented/tree/next-auth-mongoose-mongodb)
<br />

Under construction

- ### [nestjs-nextjs-next-auth-prisma-sqlite](https://github.com/pjborowiecki/SAASY-LAND-Next-13-Starters-With-Authentication-And-Database-Implemented/tree/nestjs-nextjs-next-auth-prisma-sqlite)

Under construction

- ### [nestjs-nextjs-next-auth-drizzle-sqlite](https://github.com/pjborowiecki/SAASY-LAND-Next-13-Starters-With-Authentication-And-Database-Implemented/tree/nestjs-nextjs-next-auth-drizzle-sqlite)

Under construction

- ### [mern-nextjs-redux](https://github.com/pjborowiecki/SAASY-LAND-Next-13-Starters-With-Authentication-And-Database-Implemented/tree/mern-nextjs-redux)

Under construction

- ### [next-auth-supabase-postgres](https://github.com/pjborowiecki/SAASY-LAND-Next-13-Starters-With-Authentication-And-Database-Implemented/tree/next-auth-supabase-postgres)

Under construction

- ### [supabase-postgres](https://github.com/pjborowiecki/SAASY-LAND-Next-13-Starters-With-Authentication-And-Database-Implemented/tree/supabase-postgres)
![public/images/screenshots/screenshot_1](./public/images/screenshots/screenshot_1.png)

Under construction
![public/images/screenshots/screenshot_2](./public/images/screenshots/screenshot_2.png)

- ### [django-rest-djoser-digital-ocean-spaces-aws-ses-next-redux](https://github.com/pjborowiecki/SAASY-LAND-Next-13-Starters-With-Authentication-And-Database-Implemented/tree/django-rest-djoser-digital-ocean-spaces-aws-ses-next-redux)
![public/images/screenshots/screenshot_3](./public/images/screenshots/screenshot_3.png)

# Under construction
![public/images/screenshots/screenshot_4](./public/images/screenshots/screenshot_4.png)
Loading