Boilerplate By Gede Dewo Wahyu M.W ❤️
This boilerplate is a web application built with Next.js, a React framework for modern web development. It includes features such as authentication, theme management, state management, form validation, and more. It also follows Atomic Design principles for organizing components.
Below is the primary directory structure of the boilerplate:
└── 📁configs
└── 📁authentication
└── 📁docs
└── 📁src
└── 📁app
└── 📁(authed)
└── 📁(admin)
└── 📁(user)
└── 📁(example)
└── 📁admin-example
└── 📁home-example
└── 📁user-example
└── 📁api
└── 📁auth
└── 📁[...nextauth]
└── 📁authentication
└── 📁login
└── 📁register
└── 📁denied
└── 📁fonts
└── 📁components
└── 📁elements
└── 📁templates
└── index.ts
└── README.md
└── 📁context
└── 📁hooks
└── 📁ui
└── 📁utils
| └── index.ts
└── 📁layouts
└── 📁authentication
└── 📁example
└── 📁global
└── 📁pages
└── 📁template
└── 📁modules
└── 📁aside
└── 📁footer
└── 📁header
└── 📁main
└── 📁nav
└── index.tsx
└── 📁home
└── 📁password
└── 📁profile
└── 📁libs
└── 📁constants
└── 📁providers
└── 📁next-auth
└── 📁next-themes
└── 📁react-query
└── index.ts
└── 📁tailwind-merge
└── index.ts
└── 📁schemas
└── 📁authentication
└── 📁example
└── 📁password
└── 📁profile
└── index.ts
└── 📁styles
└── 📁types
└── 📁api
└── 📁components
└── 📁context
└── index.ts
└── next-auth.d.ts
└── 📁utils
└── 📁api
└── 📁helpers
└── 📁server
└── index.ts
└── middleware.ts
- /configs: Configuration files, including authentication settings and logic.
- /docs: Project documentation such as architecture diagrams, flowcharts, API docs, and other technical references.
- /public: Static assets such as images and animations.
- /src/app: Application routes/pages, including login, admin, and user areas.
- /src/components: Reusable components organized with Atomic Design principles.
- /src/context: Context providers for state management and cross-component data sharing.
- /src/hooks: Custom hooks for managing state and side effects.
- /src/layouts: Layouts for various parts of the app (header, footer, aside, etc.), structured using Atomic Design.
- /src/libs: Libraries such as providers for authentication and theme management, plus constants.
- /src/schemas: Validation schemas (Zod) to ensure incoming data meets expectations.
- /src/styles: Global styles, CSS modules, and other styling-related files.
- /src/types: TypeScript type definitions to ensure type safety.
- /src/utils: Utility functions used throughout the application.
- /src/middleware.ts: Middleware for handling requests and responses.
To get started, follow these steps:
-
Clone the repository
git clone https://github.com/gdwmw/Next.js-Boilerplate.git cd Next.js-Boilerplate
-
Install dependencies
bun install
-
Set up environment variables
bun cpenv
-
Set
NEXTAUTH_URL
to your local URLhttp://localhost:3000
-
Generate a base64 value for
NEXTAUTH_SECRET
bun base64
-
Run the development server
bun dev
-
Access the application
Open your browser and navigate to http://localhost:3000.
When committing changes with bun commit
, follow these steps:
-
Prepare your changes
Ensure your code is tested and complies with the project's coding standards. -
Stage your changes
Stage all relevant files:git add .
-
Run the commit command
Execute:bun commit
-
Follow the interactive prompt
Select the appropriate change type (e.g., feature, fix, docs) when prompted. -
Optionally provide a scope
If relevant, specify the scope (e.g., a specific module or feature). -
Write a concise subject
Use the imperative mood and keep it short and clear. -
Optionally add a detailed body
Include motivation, context, and implementation details if helpful. -
Document breaking changes (if any)
Clearly list any breaking changes in the designated section. -
Confirm your commit
Review the message and confirm when prompted.
Following these guidelines ensures commit messages are informative and consistent with the project's standards.
If you would like to contribute, follow these steps:
-
Fork the repository
Click the "Fork" button at the top right of the repository page. -
Clone your fork
Clone your forked repository to your local machine:git clone https://github.com/your-username/Next.js-Boilerplate.git cd Next.js-Boilerplate
-
Create a new branch
Create a branch for your feature or bug fix:git checkout -b your-feature-branch
-
Make your changes
Implement your changes and ensure they follow the project's standards. -
Commit your changes
Commit with a descriptive message:bun commit
-
Push to your fork
Push your branch to your forked repository:git push origin your-feature-branch
-
Open a pull request
In the original repository, click "New Pull Request", select your branch, and submit with a clear description.
Thank you for contributing!
This project is licensed under the MIT License. See the LICENSE
file for details.
If you have questions about the boilerplate or how to use it, follow these guidelines:
-
Be clear and concise
Clearly state your question or issue and provide enough context. -
Include relevant details
Share specific errors, code snippets, or configurations that are relevant. -
Search before asking
Review the documentation and existing issues to avoid duplicates. -
Use proper formatting
Use code blocks when sharing code or error messages for readability. -
Be respectful
Be polite and respectful in all communication.
Following these guidelines helps ensure your questions are understood and answered promptly.
This documentation provides an overview of the boilerplate, installation steps, commit guidelines, and contribution process. If you have further questions, feel free to ask!