This is a boilerplate codebase for building web applications with Next.js that includes user authentication, SCSS for styling, and a structured API route setup. It utilizes the next-iron-session library for managing user sessions.
- User authentication (login, signup, logout) using Next.js API routes.
- SCSS integration for styling your application.
- Organized API routes for handling server-side logic.
Before you begin, make sure you have the following software installed on your machine:
-
Clone this repository to your local machine:
git clone <repository_url> cd next-boilerplate
-
Install dependencies
npm install or yarn install
-
Configure environment variables
DATABASE_URL = 'YOUR_DATABASE_URL' APPLICATION_SECRET='YOUR_APPLICATION_SECRET' NODE_ENV='NODE_ENV'
-
Start development server
npm run dev or yarn dev
-
Your application should now be running at http://localhost:3000.
-
Authentication Routes: The
pages/api/auth
folder contains authentication API routes (login.js
,signup.js
,logout.js
) for you to implement your authentication logic. -
Styles: Add stylesheets in SCSS format to the
styles
folder and import them in your components. -
Customization: Customize the pages in the
pages
directory according to your application requirements.
To deploy your Next.js application, follow the deployment instructions for your chosen hosting platform. Popular options include: