Skip to content

Commit e31cee9

Browse files
author
Developer
committed
Add basic Next.js project structure
1 parent bc76f7b commit e31cee9

File tree

4 files changed

+179
-0
lines changed

4 files changed

+179
-0
lines changed

next.config.js

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
/** @type {import('next').NextConfig} */
2+
const nextConfig = {
3+
reactStrictMode: true,
4+
swcMinify: true,
5+
poweredByHeader: false, // Remove X-Powered-By header for security
6+
compress: true, // Enable gzip compression
7+
8+
// Performance optimizations
9+
experimental: {
10+
optimizeCss: true,
11+
scrollRestoration: true,
12+
largePageDataBytes: 128 * 100000, // 12.8MB for large file support
13+
},
14+
15+
// Allow cross-origin requests for network access
16+
allowedDevOrigins: ['192.168.1.33', '192.168.56.1'],
17+
18+
// Image optimization
19+
images: {
20+
domains: ['localhost'],
21+
formats: ['image/webp', 'image/avif'],
22+
minimumCacheTTL: 86400, // 24 hours cache
23+
dangerouslyAllowSVG: true,
24+
contentSecurityPolicy: "default-src 'self'; script-src 'none'; sandbox;",
25+
},
26+
27+
// Headers for better performance and security
28+
async headers() {
29+
return [
30+
{
31+
source: '/(.*)',
32+
headers: [
33+
{
34+
key: 'X-Content-Type-Options',
35+
value: 'nosniff'
36+
},
37+
{
38+
key: 'X-Frame-Options',
39+
value: 'DENY'
40+
},
41+
{
42+
key: 'Referrer-Policy',
43+
value: 'strict-origin-when-cross-origin'
44+
}
45+
]
46+
},
47+
{
48+
source: '/api/(.*)',
49+
headers: [
50+
{
51+
key: 'Cache-Control',
52+
value: 'no-store, max-age=0'
53+
}
54+
]
55+
},
56+
{
57+
source: '/_next/static/(.*)',
58+
headers: [
59+
{
60+
key: 'Cache-Control',
61+
value: 'public, max-age=31536000, immutable'
62+
}
63+
]
64+
}
65+
];
66+
},
67+
68+
// Environment variables
69+
env: {
70+
MONGODB_URI: process.env.MONGODB_URI,
71+
GEMINI_API_KEY: process.env.GEMINI_API_KEY,
72+
},
73+
74+
// Webpack optimizations
75+
webpack: (config, { isServer, dev }) => {
76+
// Optimize bundle size in production
77+
if (!dev && !isServer) {
78+
config.optimization = {
79+
...config.optimization,
80+
splitChunks: {
81+
...config.optimization.splitChunks,
82+
cacheGroups: {
83+
...config.optimization.splitChunks.cacheGroups,
84+
vendor: {
85+
test: /[\\/]node_modules[\\/]/,
86+
name: 'vendors',
87+
chunks: 'all',
88+
},
89+
},
90+
},
91+
};
92+
}
93+
94+
return config;
95+
},
96+
}
97+
98+
module.exports = nextConfig

postcss.config.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
module.exports = {
2+
plugins: {
3+
tailwindcss: {},
4+
autoprefixer: {},
5+
},
6+
}

tailwind.config.js

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
/** @type {import('tailwindcss').Config} */
2+
module.exports = {
3+
content: [
4+
'./pages/**/*.{js,ts,jsx,tsx,mdx}',
5+
'./components/**/*.{js,ts,jsx,tsx,mdx}',
6+
'./app/**/*.{js,ts,jsx,tsx,mdx}',
7+
],
8+
theme: {
9+
extend: {
10+
colors: {
11+
primary: {
12+
50: '#eff6ff',
13+
100: '#dbeafe',
14+
200: '#bfdbfe',
15+
300: '#93c5fd',
16+
400: '#60a5fa',
17+
500: '#3b82f6',
18+
600: '#2563eb',
19+
700: '#1d4ed8',
20+
800: '#1e40af',
21+
900: '#1e3a8a',
22+
},
23+
accent: {
24+
500: '#8b5cf6',
25+
600: '#7c3aed',
26+
}
27+
},
28+
animation: {
29+
'fade-in': 'fadeIn 0.5s ease-in-out',
30+
'slide-up': 'slideUp 0.5s ease-out',
31+
},
32+
keyframes: {
33+
fadeIn: {
34+
'0%': { opacity: '0' },
35+
'100%': { opacity: '1' },
36+
},
37+
slideUp: {
38+
'0%': { transform: 'translateY(20px)', opacity: '0' },
39+
'100%': { transform: 'translateY(0)', opacity: '1' },
40+
}
41+
}
42+
},
43+
},
44+
plugins: [
45+
require('@tailwindcss/typography'),
46+
],
47+
}

tsconfig.json

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"compilerOptions": {
3+
"target": "es5",
4+
"lib": ["dom", "dom.iterable", "es6"],
5+
"allowJs": true,
6+
"skipLibCheck": true,
7+
"strict": true,
8+
"noEmit": true,
9+
"esModuleInterop": true,
10+
"module": "esnext",
11+
"moduleResolution": "bundler",
12+
"resolveJsonModule": true,
13+
"isolatedModules": true,
14+
"jsx": "preserve",
15+
"incremental": true,
16+
"plugins": [
17+
{
18+
"name": "next"
19+
}
20+
],
21+
"baseUrl": ".",
22+
"paths": {
23+
"@/*": ["./*"]
24+
}
25+
},
26+
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
27+
"exclude": ["node_modules"]
28+
}

0 commit comments

Comments
 (0)