bug-tracker

所属分类:调试/Bug
开发工具:TypeScript
文件大小:0KB
下载次数:0
上传日期:2023-10-21 14:13:47
上 传 者sh-1993
说明:  错误跟踪器,
(Bug tracker,)

文件列表:
.env (812, 2023-11-16)
.eslintrc.json (40, 2023-11-16)
app/ (0, 2023-11-16)
app/NavBar.tsx (2395, 2023-11-16)
app/QueryClientProvider.tsx (436, 2023-11-16)
app/api/ (0, 2023-11-16)
app/api/auth/ (0, 2023-11-16)
app/api/auth/[...nextauth]/ (0, 2023-11-16)
app/api/auth/[...nextauth]/route.ts (168, 2023-11-16)
app/api/issues/ (0, 2023-11-16)
app/api/issues/[id]/ (0, 2023-11-16)
app/api/issues/[id]/route.ts (1831, 2023-11-16)
app/api/issues/route.ts (1032, 2023-11-16)
app/api/users/ (0, 2023-11-16)
app/api/users/route.ts (282, 2023-11-16)
app/auth/ (0, 2023-11-16)
app/auth/Provider.tsx (265, 2023-11-16)
app/auth/authOptions.ts (488, 2023-11-16)
app/components/ (0, 2023-11-16)
app/components/ErrorMessage.tsx (290, 2023-11-16)
app/components/IssueStatusBadge.tsx (556, 2023-11-16)
app/components/Link.tsx (366, 2023-11-16)
app/components/Pagination.tsx (1761, 2023-11-16)
app/components/Skeleton.tsx (124, 2023-11-16)
app/components/Spinner.tsx (492, 2023-11-16)
app/components/index.ts (265, 2023-11-16)
app/favicon.ico (25931, 2023-11-16)
app/globals.css (422, 2023-11-16)
app/issues/ (0, 2023-11-16)
app/issues/[id]/ (0, 2023-11-16)
app/issues/[id]/AssigneeSelect.tsx (1641, 2023-11-16)
app/issues/[id]/DeleteIssueButton.tsx (2240, 2023-11-16)
app/issues/[id]/EditIssueButton.tsx (457, 2023-11-16)
app/issues/[id]/IssueDetails.tsx (659, 2023-11-16)
app/issues/[id]/loading.tsx (493, 2023-11-16)
app/issues/[id]/page.tsx (1497, 2023-11-16)
app/issues/_components/ (0, 2023-11-16)
app/issues/_components/IssueForm.tsx (2451, 2023-11-16)
... ...

# Video [class-1](https://youtu.be/M0Fsrt9V9HE) [class-2](https://youtu.be/at07DRKHj6Q) [class-3](https://youtu.be/G-0p_SFPuXg) [class-4](https://youtu.be/rV4W7R3zw58) [class-5](https://youtu.be/E9AKo0TKErA) [class-6](https://youtu.be/fQY8B5mJHUo) [class-7A](https://youtu.be/JGc5p9vjDE4) [class-7B](https://youtu.be/Z1w81dObkBQ) [class-8-Auth-1](https://youtu.be/vnpggK3y5c8) [class-8-Auth-2](https://youtu.be/16oqQFGM30c) [class-8-Auth-3](https://youtu.be/9iPDVs89-iM) [class-9-Assign Issue-1](https://youtu.be/Wlj9GYuMVug) [class-10-Assign Issue-2](https://youtu.be/fcLIpe2UfWc) [class-10-Assign Issue-3](https://youtu.be/mmjTk05mrDw) [class-11-Filter - 1](https://youtu.be/uJo7MGq6k1Y) [class-12-Filter - 2](https://youtu.be/VBCEd6rVqKI) [class-13-Pagination](https://youtu.be/CybZMdoQkMo) [class-14-Dashboard and hosting](https://youtu.be/5Y-u5eIXAns) # 1. Introduction (10m) Build a full-stack production-grade application Issue-tracker - In modern web, these are the few common features. - Dashboard with chart - Filtering, sorting, pagination - Forms with client side validation - User authentication and access control - Model dialog box and tost notification By the end of the course everyone should be confident in building fast, responsive fully functional web application and able to host. **Stack** - Nextjs, Typescript, tailwindcss, Radix UI, Prisma, NextAuth **Learning Goal** - How to structure your application - How to write clean, professional quality code, that align with industry standard and best practices. - How to think like software Engineer. **What should you know** - Client and Server component's - Routing, Building API - Database integration with Prisma - Authentication with NextAuth **Project Roadmap** - May be you thinking how to start and finish the project, which component should i build first. `Lets take simple approach, divide the project in 2 parts` **core/Essential Features** - Create an issue, setup database - Viewing Issues - Updating Issue - Deleting Issue **Advance Features** - User Authentication - Assigning issues - Sorting, Filtering, Pagination - Dashboard **Important Point to remember** - When we are building this application we are going to focus one feature at a time. - When building feature, our goal is not to come with perfect solution, first we build the working feature, then improve the code. **there is no such thing as `Perfect in software development`** `Make it first work and improve it` # 2. Setting Up the Project (45m) - create new github repository issue-tracker - clone window>`git clone https://github.com/369webforall/bug-tracker.git` - open in vscode (add extension ES7+React/redux/ Tailwind css intellisent / Prisma / Javascript/Typescript) - install next-js, with typescript and tailwind css `npx create-next-app@latest ./` - clean the code. git add . git commit -m "project setup" git push **NavBar.tsx** - crate NavBar.tsx file in app directory - install react-icons (`npm i react-icons`) - install classnames (`npm i classnames`) - once navbar is complete git add . git commit -m "Navbar completed" git push # 3. Creating Issues (database setup) (80m) **1. Database setup** - Mongodb - create project in mongodb atlas, save password, copy the link of your project. **2. Setting up prisma** - install prisma (`npm i prisma`) - intialize prisma (`npx prisma init`) - change provider datasource db { provider = "mongodb" url = env("DATABASE_URL") } **3. Creating the issue model** - create model as below ```javascript model Issue { id String @id @default(auto()) @map("_id") @db.ObjectId title String description String status Status @default(OPEN) createdAt DateTime @default(now()) updatedAt DateTime @updatedAt } ``` - `npx prisma format` this will format the code (Prisma Client is a TypeScript (or JavaScript) library that provides a type-safe and auto-completing API for interacting with your database. When you run npx prisma generate, Prisma generates the necessary code based on your Prisma schema and the database you're using.) - `npx prisma db push` - it sync the schema with our database (creating database and table) `git add .` `git commit -m "setup prisma and model"` `git push` [Guide Prisma-mongodb](https://www.prisma.io/docs/guides/database/mongodb) **4. Building an API** - app>api>issues>route.tsx - add api code to post method. - install zod for data validation - to store data(issue) we need to create prisma client. - in prisma>client.ts (`add the code from nextjs-prisma client documentation`) ```javascript import { NextRequest, NextResponse } from 'next/server'; import prisma from '@/prisma/client'; import { z } from 'zod'; const createIssueSchema = z.object({ title: z.string().min(3).max(255), description: z.string().min(1), }); export async function POST(request: NextRequest) { const body = await request.json(); const validation = createIssueSchema.safeParse(body); if (!validation.success) { return NextResponse.json(validation.error.errors, { status: 400 }); } const newIssue = await prisma.issue.create({ data: { title: body.title, description: body.description }, }); return NextResponse.json(newIssue, { status: 201 }); } ``` **5. Setting up Redix UI** - To build the new issue page we will use radix UI, very popular component library. - Radix comes in to flavour, Themes and Primitives, themes have pre build component ready to use, where Primitives have only behaviour, and we have to style ourself. - step1 `npm install @radix-ui/themes` - step2 `import '@radix-ui/themes/styles.css;` - step3 ` Add the Theme component` [install Radix](https://www.radix-ui.com/themes/docs/overview/getting-started) - import Button component in issue page and test. `git add . // git commit -m "setup radix ui" // git push` **6. Building the new issue page** - In this section we are just going to build the form with two field, title and description. - issues>new>page.tsx - add the form from radix ui. ```javascript 'use client'; import React from 'react'; import { TextField, TextArea, Button } from '@radix-ui/themes'; const NewIssuePage = () => { return (