Fullstack Blog Application with Next.js (GraphQL API)
Note: This project is working in progress.
This is a fully-featured starter kit, which should enable fast, secure development of advanced applications. This example shows how to implement a fullstack app in TypeScript with using below key ingredients.
- TypeScript to ensure the highest code quality
- Node.js to run JavaScript on the server
- Next.js to bundle source files and render web pages both on the server and the client
- React to describe interface components
- Apollo GraphQL client with graphql-codegen
- Prisma Modern DB toolkit to query, migrate and model your database
- Nexus Code-First, Type-Safe, GraphQL Schema Construction
- ESLint and Prettier to ensure that source files are error-free and easy to read
CN-Blog is made with a lot of functionality in mind.
Here is the complete list of current features in CN-Blog:
- React Hooks
- Forms & form handling
- Client-side form validation
- Styling & Theming
- User handling & dashboard
- Graphql
- Dynamic routing
- Prisma
- Nexus
- Code linting
- Code style & formatting
- Bundle size checking
- Automated Test
- XSS & CSRF prevention
Before beginning, please make sure you have the following tools installed.
- Node.js (>= 12.x, download)
yarn(>= 1.22, instructions)- Postgres (macOS, or others)
- Clone this repository:
git clone git@github.com:codenuru/cn-blog.git --depth=1- Install dependencies:
cd cn-blog
yarn-
Before beginning, please make sure you have the following enviroment variable set. We are provided example enviroment variables in root and prisma directory
-
copy to ".env.example" to ".env.local". you don't need to set variables Next.js has built-in support for loading environment variables.
cp .env.example .env.local
-
Updated: prisma now check .env file in prisma and root folder instructions
Please add your Postgres Database URL to ".env" file.
-
-
Migrate your database following arguments
yarn migrate:save
yarn migrate:up
yarn devThe app is now running, navigate to http://localhost:3000/ in your browser to explore its UI.
Evolving the application typically requires five subsequent steps:
- Migrating the database schema using SQL
- Updating your Prisma schema by introspecting the database with
introspect - Generating Prisma Client to match the new database schema with
generate:prisma - Using the updated Prisma Client in your application code and extending the GraphQL API and use
generate - Building new UI features in React
For the following example scenario, assume you want to add a "profile" feature to the app where users can create a profile and write a short bio about themselves.
In order
- Documentation
- A good settings configuration
- Add CRUD operations Tag and Category
- (Main) Show Posts and Post Page
- Update: React 17 and nextJS 10
- (Portal) Create Post Page
- (Main) Implement Tag and Category
- (Portal) Create Tag and Category
- (Portal) Create and Manage User Page
- (Main) Create Comment Component
- (Main) Show Comments in Post Page
- (Portal) Manage Comment
- (Main) Show User's Posts
- Update: Nexus 1 and Prisma 2.13.1
- Fix: Getting loop different lang
- Fix: Client auth working even though token invalid
