Skip to content

Commit 9f3701f

Browse files
committed
nextjs-dashboard
1 parent 3d58496 commit 9f3701f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+4494
-5376
lines changed

.env.example

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Copy from .env.local on the Vercel dashboard
2+
# https://nextjs.org/learn/dashboard-app/setting-up-your-database#create-a-postgres-database
3+
POSTGRES_URL=
4+
POSTGRES_PRISMA_URL=
5+
POSTGRES_URL_NON_POOLING=
6+
POSTGRES_USER=
7+
POSTGRES_HOST=
8+
POSTGRES_PASSWORD=
9+
POSTGRES_DATABASE=
10+
11+
# `openssl rand -base64 32`
12+
AUTH_SECRET=
13+
AUTH_URL=http://localhost:3000/api/auth

.gitignore

Lines changed: 26 additions & 120 deletions
Original file line numberDiff line numberDiff line change
@@ -1,130 +1,36 @@
1-
# Logs
2-
logs
3-
*.log
4-
npm-debug.log*
5-
yarn-debug.log*
6-
yarn-error.log*
7-
lerna-debug.log*
8-
.pnpm-debug.log*
9-
10-
# Diagnostic reports (https://nodejs.org/api/report.html)
11-
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
12-
13-
# Runtime data
14-
pids
15-
*.pid
16-
*.seed
17-
*.pid.lock
18-
19-
# Directory for instrumented libs generated by jscoverage/JSCover
20-
lib-cov
21-
22-
# Coverage directory used by tools like istanbul
23-
coverage
24-
*.lcov
25-
26-
# nyc test coverage
27-
.nyc_output
28-
29-
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
30-
.grunt
31-
32-
# Bower dependency directory (https://bower.io/)
33-
bower_components
34-
35-
# node-waf configuration
36-
.lock-wscript
37-
38-
# Compiled binary addons (https://nodejs.org/api/addons.html)
39-
build/Release
40-
41-
# Dependency directories
42-
node_modules/
43-
jspm_packages/
44-
45-
# Snowpack dependency directory (https://snowpack.dev/)
46-
web_modules/
47-
48-
# TypeScript cache
49-
*.tsbuildinfo
1+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
502

51-
# Optional npm cache directory
52-
.npm
3+
# dependencies
4+
/node_modules
5+
/.pnp
6+
.pnp.js
537

54-
# Optional eslint cache
55-
.eslintcache
8+
# testing
9+
/coverage
5610

57-
# Optional stylelint cache
58-
.stylelintcache
11+
# next.js
12+
/.next/
13+
/out/
5914

60-
# Microbundle cache
61-
.rpt2_cache/
62-
.rts2_cache_cjs/
63-
.rts2_cache_es/
64-
.rts2_cache_umd/
15+
# production
16+
/build
6517

66-
# Optional REPL history
67-
.node_repl_history
18+
# misc
19+
.DS_Store
20+
*.pem
6821

69-
# Output of 'npm pack'
70-
*.tgz
71-
72-
# Yarn Integrity file
73-
.yarn-integrity
22+
# debug
23+
npm-debug.log*
24+
yarn-debug.log*
25+
yarn-error.log*
7426

75-
# dotenv environment variable files
27+
# local env files
28+
.env*.local
7629
.env
77-
.env.development.local
78-
.env.test.local
79-
.env.production.local
80-
.env.local
81-
82-
# parcel-bundler cache (https://parceljs.org/)
83-
.cache
84-
.parcel-cache
85-
86-
# Next.js build output
87-
.next
88-
out
89-
90-
# Nuxt.js build / generate output
91-
.nuxt
92-
dist
93-
94-
# Gatsby files
95-
.cache/
96-
# Comment in the public line in if your project uses Gatsby and not Next.js
97-
# https://nextjs.org/blog/next-9-1#public-directory-support
98-
# public
9930

100-
# vuepress build output
101-
.vuepress/dist
31+
# vercel
32+
.vercel
10233

103-
# vuepress v2.x temp and cache directory
104-
.temp
105-
.cache
106-
107-
# Docusaurus cache and generated files
108-
.docusaurus
109-
110-
# Serverless directories
111-
.serverless/
112-
113-
# FuseBox cache
114-
.fusebox/
115-
116-
# DynamoDB Local files
117-
.dynamodb/
118-
119-
# TernJS port file
120-
.tern-port
121-
122-
# Stores VSCode versions used for testing VSCode extensions
123-
.vscode-test
124-
125-
# yarn v2
126-
.yarn/cache
127-
.yarn/unplugged
128-
.yarn/build-state.yml
129-
.yarn/install-state.gz
130-
.pnp.*
34+
# typescript
35+
*.tsbuildinfo
36+
next-env.d.ts

README.md

Lines changed: 116 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,119 @@
1-
# NextJS15-React19-Training-InstillLearning
2-
```console
3-
Step 1: Create new Next.js App using create-next-app
4-
$ npx create-next-app@latest
5-
6-
✔ What is your project named? … my-app
7-
✔ Would you like to use TypeScript? … No
8-
✔ Would you like to use ESLint? … Yes
9-
✔ Would you like to use Tailwind CSS? … No
10-
✔ Would you like your code inside a `src/` directory? … Yes
11-
✔ Would you like to use App Router? (recommended) … Yes
12-
✔ Would you like to use Turbopack for next dev? … Yes
13-
✔ Would you like to customize the import alias (@/* by default)? … No
14-
15-
Here is the package.json, when app created:
16-
```
17-
```json
18-
{
19-
"name": "my-app",
20-
"version": "0.1.0",
21-
"private": true,
22-
"scripts": {
23-
"dev": "next dev --turbopack",
24-
"build": "next build",
25-
"start": "next start",
26-
"lint": "next lint"
27-
},
28-
"dependencies": {
29-
"react": "^19.0.0",
30-
"react-dom": "^19.0.0",
31-
"next": "15.0.4"
32-
},
33-
"devDependencies": {
34-
"eslint": "^8",
35-
"eslint-config-next": "15.0.4"
36-
}
37-
}
1+
## Next.js App Router Course - Starter - https://nextjs.org/learn/dashboard-app
2+
This is the starter template for the Next.js App Router Course. It contains the starting code for the dashboard application.
3+
4+
5+
### Creating a new project
6+
#### install npmp (as it is faster than npm and yarn)
7+
```shell
8+
$ npm install -g pnpm
389
```
3910

40-
```console
41-
Step 2: Run the app
42-
$ cd my-app
43-
$ npm run dev
11+
#### create starting app using create-next-app
12+
```shell
13+
$ npx create-next-app@latest nextjs-dashboard --example "https://github.com/vercel/next-learn/tree/main/dashboard/starter-example" --use-pnpm
14+
15+
$ cd nextjs-dashboard
4416
```
45-
![Screenshot](./my-app/Screenshot2.png "Optional Title Text")
17+
## Folder Structure
18+
19+
- **`/app`**
20+
Contains all the routes, components, and logic for your application. This is where you'll be working most of the time.
21+
22+
- **`/app/lib`**
23+
Contains functions used in your application, such as reusable utility functions and data fetching functions.
24+
25+
- **`/app/ui`**
26+
Contains all the UI components for your application, such as cards, tables, and forms. These components are pre-styled to save development time.
27+
28+
- **`/public`**
29+
Contains all the static assets for your application, such as images.
30+
31+
- **Config Files**
32+
At the root of your application, you'll find config files like `next.config.js`. These files are created and pre-configured when you start a new project using `create-next-app`.
33+
34+
35+
## Dependencies and Their Uses
36+
37+
### Dependencies
38+
1. **`@heroicons/react`**
39+
A library of free SVG icons designed for React. Useful for adding consistent and visually appealing icons to your application.
40+
41+
2. **`@tailwindcss/forms`**
42+
A Tailwind CSS plugin that provides better default styling for form elements like inputs, selects, and buttons, making forms look more consistent and polished.
43+
44+
3. **`@vercel/postgres`**
45+
A library to interact with PostgreSQL databases directly, optimized for serverless environments on Vercel. Perfect for integrating database operations in your Next.js app.
46+
47+
4. **`autoprefixer`**
48+
A PostCSS plugin that automatically adds vendor prefixes to your CSS, ensuring compatibility across different browsers.
49+
50+
5. **`bcrypt`**
51+
A library for hashing passwords securely. Commonly used for user authentication and securely storing passwords in the database.
52+
53+
6. **`clsx`**
54+
A small utility for conditionally joining class names. Useful for dynamically applying CSS classes in React components.
55+
56+
7. **`next`**
57+
The Next.js framework itself. Provides features like server-side rendering, static site generation, API routes, and more.
58+
59+
8. **`next-auth`**
60+
A library to manage authentication in your Next.js app. Supports various providers like Google, GitHub, email/password, and custom credentials.
61+
62+
9. **`postcss`**
63+
A CSS processor that transforms styles with plugins. Tailwind CSS uses it internally for processing your CSS.
64+
65+
10. **`react`**
66+
The core library for building user interfaces in a declarative way.
67+
68+
11. **`react-dom`**
69+
Provides DOM-specific methods for React. Used to render React components to the DOM.
70+
71+
12. **`tailwindcss`**
72+
A utility-first CSS framework for building modern, responsive designs efficiently.
73+
74+
13. **`typescript`**
75+
A superset of JavaScript that adds static typing, making your code more robust and less prone to errors.
76+
77+
14. **`use-debounce`**
78+
A React hook for debouncing values or functions. Useful for improving performance in search inputs or API calls by reducing the frequency of executions.
79+
80+
15. **`zod`**
81+
A TypeScript-first schema validation library. Useful for validating and parsing data, ensuring type safety.
82+
83+
---
84+
85+
### DevDependencies
86+
1. **`@types/bcrypt`**
87+
Type definitions for the `bcrypt` library, providing IntelliSense and type-checking in TypeScript.
88+
89+
2. **`@types/node`**
90+
Type definitions for Node.js, helping with type safety and IntelliSense when working with Node.js APIs.
91+
92+
3. **`@types/react`**
93+
Type definitions for React, ensuring proper type support for React components and hooks in TypeScript.
94+
95+
4. **`@types/react-dom`**
96+
Type definitions for `react-dom`, enabling type safety for React's DOM rendering APIs in TypeScript.
97+
98+
---
99+
100+
### How These Work Together
101+
- **Styling:**
102+
`tailwindcss`, `autoprefixer`, and `@tailwindcss/forms` handle styling, ensuring modern and responsive designs.
103+
104+
- **Authentication and Security:**
105+
`bcrypt` and `next-auth` handle secure password hashing and user authentication.
106+
107+
- **Database and Backend:**
108+
`@vercel/postgres` integrates database operations seamlessly with Vercel.
109+
110+
- **React Ecosystem:**
111+
`react`, `react-dom`, and `clsx` support the core UI functionality, while `@heroicons/react` adds icons.
112+
113+
- **Validation and Performance:**
114+
`zod` ensures data integrity, and `use-debounce` optimizes performance.
115+
116+
- **TypeScript:**
117+
`typescript` and related `@types/*` packages provide type safety and improved developer experience.
118+
119+
This setup offers a robust foundation for building a modern, scalable, and secure Next.js application.

app/dashboard/customers/page.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export default function Page() {
2+
return <p>Customers Page</p>;
3+
}

app/dashboard/invoices/page.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export default function Page() {
2+
return <p>Invoices Page</p>;
3+
}

app/dashboard/layout.tsx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import SideNav from '@/app/ui/dashboard/sidenav';
2+
3+
export default function Layout({ children }: { children: React.ReactNode }) {
4+
return (
5+
<div className="flex h-screen flex-col md:flex-row md:overflow-hidden">
6+
<div className="w-full flex-none md:w-64">
7+
<SideNav />
8+
</div>
9+
<div className="flex-grow p-6 md:overflow-y-auto md:p-12">{children}</div>
10+
</div>
11+
);
12+
}

app/dashboard/page.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export default function Page() {
2+
return <p>Dashboard Page</p>;
3+
}

app/layout.tsx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import '@/app/ui/global.css';
2+
import { inter } from '@/app/ui/fonts';
3+
4+
export default function RootLayout({
5+
children,
6+
}: {
7+
children: React.ReactNode;
8+
}) {
9+
return (
10+
<html lang="en">
11+
<body className={`${inter.className} antialiased`}>{children}</body>
12+
</html>
13+
);
14+
}

0 commit comments

Comments
 (0)