项目作者: princejoogie

项目描述 :
Postgres, Express, React, Node - Stack Boilerplate
高级语言: TypeScript
项目地址: git://github.com/princejoogie/pern-boilerplate.git
创建时间: 2021-08-22T16:58:38Z
项目社区:https://github.com/princejoogie/pern-boilerplate

开源协议:

下载


PERN Boilerplate

🚧 WORK IN PROGRESS 🚧

upcoming features:

  • Email confirmation
  • Socials Login

Features

  • GraphQL Server
  • JWT Authentication
  • Auto refresh access tokens on expire
  • Schema generation for client side (server schema stays in sync with client schema)

Tech Stack

Client

Server


Prerequisites

  1. Node (Download)
  2. Postgres (Download)
  3. optional Yarn (npm install)

Usage

  1. Clone the repository
  1. git clone --depth 1 https://github.com/princejoogie/pern-boilerplate.git <project-name>

Server

  1. Install dependencies
  1. cd ./<project-name>/server && npm install
  2. # or
  3. cd ./<project-name>/server && yarn
  1. Setup ormconfig.json
  1. # replace those with "< >" to how you setup your postgres
  2. {
  3. "type": "postgres",
  4. "host": "localhost",
  5. "port": 5432,
  6. "username": <postgres-username>,
  7. "password": <postgres-password>,
  8. "database": <db-name>,
  9. "synchronize": true,
  10. "logging": true,
  11. "entities": ["src/entity/**/*.ts"],
  12. "migrations": ["src/migration/**/*.ts"],
  13. "subscribers": ["src/subscriber/**/*.ts"],
  14. "cli": {
  15. "entitiesDir": "src/entity",
  16. "migrationsDir": "src/migration",
  17. "subscribersDir": "src/subscriber"
  18. }
  19. }
  1. Create Postgres database
    • make sure to add postgres bin to environmental variables
  1. createdb <db-name>
  2. # or run the recreate sciprt
  3. npm run schema:drop # !WARNING - this will recreate the database so only run this initially
  1. Setup .env and .env.development
  1. # Content of .env and .env.development should have these 4 variables
  2. PORT=4000
  3. BASE_URL=http://localhost
  4. ACCESS_TOKEN_SECRET=access_token_secret_here
  5. REFRESH_TOKEN_SECRET=refresh_token_secret_here
  1. Initialize migrations
  1. npm run migration:create && npm run migration:run
  1. Start the server
  1. npm run dev

Client

  1. Install dependencies
  1. cd ./<project-name>/client && npm install
  2. # or
  3. cd ./<project-name>/client && yarn
  1. Run the generate script to sync server schema to the client
  1. npm run gen
  1. Start the server
  1. npm run dev

Preview

Client

register_route_client
home_route_client

Server

graphql_playground


Prince Carlo Juguilon