Skip to content

Commit

Permalink
NextJS template setup
Browse files Browse the repository at this point in the history
  • Loading branch information
nishkohli96 committed Jan 25, 2025
0 parents commit 9e151d3
Show file tree
Hide file tree
Showing 35 changed files with 4,468 additions and 0 deletions.
31 changes: 31 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# docker
Dockerfile
compose.yml
.dockerignore

# folders
node_modules
.github
.husky
.next
.turbo
.vercel

# production
build
dist
logs
*.tsbuildinfo

# testing
coverage
.nyc_output

# misc
eslint.config.mjs
test
.gitignore
.prettierrc
.prettierignore
*.log
*.md
15 changes: 15 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# These are supported funding model platforms

github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
patreon: # Replace with a single Patreon username
open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
polar: # Replace with a single Polar username
buy_me_a_coffee: nish1896
thanks_dev: # Replace with a single thanks.dev username
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
28 changes: 28 additions & 0 deletions .github/workflows/build-app.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: build-app

on: [push]

jobs:
build:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [22.13.1]
os: [ubuntu-latest]

steps:
- name: Git Checkout
uses: actions/checkout@v4

- name: Setup Node env
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'yarn'

- name: Install dependencies
run: yarn

- name: Build nextjs-app
run: yarn build
48 changes: 48 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# folders
node_modules
logs
.cache/
.pnp
.pnp.js
.turbo
.next
.vercel
.storybook
out/
storybook-static/

# production
build
dist
*.tsbuildinfo

# testing
coverage
.nyc_output

# misc
.DS_Store
.env
.env.*
*.log
.pnp.js
*.pem
.eslintcache

# IDEs and editors
/.idea
.project
.classpath
.c9/
*.launch
.settings/
*.sublime-workspace

# IDE - VSCode
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
1 change: 1 addition & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
npx lint-staged
40 changes: 40 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# folders
node_modules
public
build
dist
.next
.vercel

# config-files
nest-cli.json
package.json
package-lock.json
test/jest-e2e.json
tsconfig.json
tsconfig.build.json
turbo.json
yarn.lock

eslint.config.mjs
.gitignore
.prettierignore
.prettierrc
.prettierrc.*
.tsbuildinfo

# static asset files
*.jpg
*.jpeg
*.png
*.svg
*.otf
*.ttf
*.woff

# custom files
*.md
*.log
*.d.ts
*.yml
*.yaml
14 changes: 14 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"arrowParens": "avoid",
"bracketSameLine": false,
"bracketSpacing": true,
"endOfLine": "lf",
"htmlWhitespaceSensitivity": "css",
"printWidth": 80,
"semi": true,
"singleAttributePerLine": false,
"singleQuote": true,
"tabWidth": 2,
"trailingComma": "es5",
"useTabs": false
}
42 changes: 42 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
FROM node:23-alpine3.20 AS builder

# Set working directory in the container
WORKDIR /app

COPY --chown=node:node package.json tsconfig.json yarn.lock ./

# Install dependencies
RUN yarn install --frozen-lockfile --non-interactive

# Copy the rest of the application code to the container
COPY --chown=node:node . .

# Build the Next.js app
RUN yarn build

# Production image
FROM node:23-alpine3.20 AS runner

# Set working directory in the container
WORKDIR /app

# Copy only the necessary build files from the builder stage
COPY --from=builder /app/package.json /app/yarn.lock ./
COPY --from=builder /app/.next ./.next
COPY --from=builder /app/public ./public
COPY --from=builder /app/node_modules ./node_modules

# Next.js collects completely anonymous telemetry data about general usage.
# Learn more here: https://nextjs.org/telemetry
# Optional: Disable telemetry
ENV NEXT_TELEMETRY_DISABLED 1

# Set environment to production
ENV NODE_ENV production

# Expose the port the Next.js app runs on (default: 3000)
EXPOSE 3000

# Start the application
CMD ["yarn", "start"]

43 changes: 43 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Next App

This is a [Next.js](https://nextjs.org) v19 project bootstrapped with [`create-next-app`](https://nextjs.org/docs/app/api-reference/cli/create-next-app) and has the following features preconfigured:

- [Typescript](https://www.typescriptlang.org/) integration
- Preconfigured [eslint](https://eslint.org/)
- [Material-UI](https://mui.com/) setup with theming
- [Tailwind CSS](https://tailwindcss.com/)

## Getting Started

First, run the development server:

```bash
npm run dev
# or
yarn dev
# or
pnpm dev
# or
bun dev
```

Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.

You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file.

This project uses [`next/font`](https://nextjs.org/docs/app/building-your-application/optimizing/fonts) to automatically optimize and load [Geist](https://vercel.com/font), a new font family for Vercel.

## Learn More

To learn more about Next.js, take a look at the following resources:

- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.

You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js) - your feedback and contributions are welcome!

## Deploy on Vercel

The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.

Check out our [Next.js deployment documentation](https://nextjs.org/docs/app/building-your-application/deploying) for more details.
8 changes: 8 additions & 0 deletions compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
services:
next-client:
image: docker-username/next-v15-template
build:
context: .
dockerfile: ./Dockerfile
ports:
- '3000:3000'
27 changes: 27 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { dirname } from 'path';
import { fileURLToPath } from 'url';
import { FlatCompat } from '@eslint/eslintrc';
import nextConfig from '@nish1896/eslint-flat-config/next';

const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);

const compat = new FlatCompat({
baseDirectory: __dirname,
});

const eslintConfig = [
...nextConfig,
...compat.extends('next/core-web-vitals', 'next/typescript'),
{
/**
* Somehow loading this rule is causing issues, when using
* NextApp in monorepo, thus disabling this for now.
*/
rules: {
'@typescript-eslint/no-empty-function': 'off'
}
}
];

export default eslintConfig;
5 changes: 5 additions & 0 deletions next-env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/// <reference types="next" />
/// <reference types="next/image-types/global" />

// NOTE: This file should not be edited
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.
7 changes: 7 additions & 0 deletions next.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import type { NextConfig } from "next";

const nextConfig: NextConfig = {
/* config options here */
};

export default nextConfig;
50 changes: 50 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{
"name": "next-v15-template",
"version": "1.0.0",
"description": "NextJS v15 template with Material-UI.",
"author": "Nishant Kohli",
"private": true,
"scripts": {
"dev": "next dev -p 3000",
"build": "next build",
"start": "next start",
"prod": "yarn build && yarn start",
"lint": "next lint --fix",
"lint:check": "next lint",
"prepare": "husky"
},
"dependencies": {
"@emotion/cache": "^11.14.0",
"@emotion/react": "^11.14.0",
"@emotion/styled": "^11.14.0",
"@mui/icons-material": "^6.4.1",
"@mui/material": "^6.4.1",
"@mui/material-nextjs": "^6.3.1",
"next": "15.1.6",
"react": "^19.0.0",
"react-dom": "^19.0.0"
},
"devDependencies": {
"@eslint/eslintrc": "^3.2.0",
"@nish1896/eslint-flat-config": "^1.1.3",
"@types/node": "^22.10.10",
"@types/react": "^19.0.8",
"@types/react-dom": "^19.0.3",
"eslint": "^9.19.0",
"eslint-config-next": "15.1.6",
"husky": "^9.1.7",
"lint-staged": "^15.4.2",
"postcss": "^8.5.1",
"prettier": "^3.4.2",
"tailwindcss": "^3.4.1",
"typescript": "^5.7.3"
},
"lint-staged": {
"*.{json,html,css,sass,scss}": [
"prettier --write --ignore-unknown"
],
"*.{js,jsx,ts,tsx}": [
"eslint --fix"
]
}
}
8 changes: 8 additions & 0 deletions postcss.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/** @type {import('postcss-load-config').Config} */
const config = {
plugins: {
tailwindcss: {},
},
};

export default config;
1 change: 1 addition & 0 deletions public/file.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions public/globe.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions public/next.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions public/vercel.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 9e151d3

Please sign in to comment.