This is a Next.js 14 project utilizing modern features for a high-performance web application. It includes TypeScript for type safety, Yup for validation, and next-intl for multilingual support.
- Server-Side Rendering (SSR): Improved SEO and faster initial load times.
- API Routes: Easily create backend endpoints.
- Middleware: Handle locale-based routing and redirections.
- TypeScript: Strong typing throughout the project.
- Validation: Use Yup for schema validation.
- Internationalization: Integration with
next-intlfor multiple languages. - CSS Modules: Scoped and modular styling.
- Node.js (v14 or higher)
- pnpm (v9.7.1)
To use private packages from GitHub Packages in your project, you need to configure your npm registry settings and generate a GitHub personal access token. Follow these steps:
-
Log in to GitHub: Go to GitHub and sign in to your account.
-
Navigate to Developer Settings:
- Click on your profile picture in the top-right corner of the page.
- Select Settings.
- In the left sidebar, click Developer settings.
-
Create a New Personal Access Token:
- Click Personal access tokens.
- Click the Generate new token button.
- Note: For enhanced security, use a GitHub App instead of personal access tokens if possible.
-
Configure the Token:
- Token description: Enter a description for the token (e.g., "NPM package access").
- Select scopes: Check the boxes for the following scopes:
read:packages(Required for installing packages)delete:packages(Optional, if you need to delete packages)
- Optionally, you can select other scopes based on your needs.
-
Generate the Token:
- Click Generate token at the bottom of the page.
- Important: Copy the token and save it somewhere secure. You won’t be able to see it again.
-
Create a
.npmrcfile: This file should be located in the root directory of your project. -
Add the following configuration to
.npmrc:@resido-fhm:registry=https://npm.pkg.github.com/ //npm.pkg.github.com/:_authToken=YOUR_PERSONAL_ACCESS_TOKEN
- Replace
@resido-fhmwith the scope of your private packages. - Replace
YOUR_PERSONAL_ACCESS_TOKENwith the token you generated in the previous step.
- Replace
-
Save the
.npmrcfile.
After setting up the .npmrc file, you can install and publish packages from GitHub Packages as you would with any other npm registry.
- Keep your
.npmrcfile secure and avoid committing it to version control if it contains sensitive information. - Use environment variables or GitHub Actions secrets to handle tokens securely in CI/CD pipelines.
For more details on configuring npm with GitHub Packages, refer to GitHub's documentation on npm package publishing.
- ** pnpm install**
Running the Development Server Start the development server with:
pnpm run dev- Visit: http://localhost:3000 in your browser to view the application in development mode.
pnpm run buildRunning the Production Server Start the production server with:
pnpm run startCheck for linting issues with:
pnpm run lintFix linting issues automatically with:
pnpm run lint:fixFormatting Check for formatting issues with:
pnpm run prettier:checkFix formatting issues automatically with:
pnpm run prettier:fix- lint: Runs ESLint and Prettier checks.
pnpm run lint- lint:fix: Fixes ESLint and Prettier issues.
pnpm run lint:fix- eslint:fix: Fixes ESLint issues.
pnpm run eslint:fix- prettier:check: Checks code formatting with Prettier.
pnpm run prettier:check- prettier:fix: Fixes code formatting with Prettier.
pnpm run prettier:fix- Next.js Configuration: Customize next.config.js for build and runtime settings.
- TypeScript Configuration: Adjust tsconfig.json for TypeScript settings.
- Yup: Configure validation schemas where needed.
- next-intl: Set up translations and locale management.
For styling, use CSS Modules. Define styles in .module.scss files and import them in your components:
import styles from './Component.module.scss';