Git Product home page Git Product logo

maximmai / nest-next-boilerplate Goto Github PK

View Code? Open in Web Editor NEW

This project forked from poprostuwitold/nest-next-boilerplate

0.0 0.0 0.0 4.17 MB

Boilerplate for Nest.js, Next.js, TypeScript stack. Includes social logins, account verification, password change & recover, real-time chats and more.

License: MIT License

JavaScript 0.82% TypeScript 98.50% CSS 0.02% Handlebars 0.24% Dockerfile 0.42%

nest-next-boilerplate's Introduction

nest-next-boilerplate

Boilerplate for Nest.js, Next.js, TypeScript stack. Includes social logins, account verification, password change & recover, real-time chats and more.

Usage

0. Environmental variables

0.1. Create .env file in server root directory and fill with following:

# APP
NODE_ENV='development'
APP_PORT=4000
ORIGIN='http://localhost:3000'
API_PREFIX='/api'

# JWT AUTH
JWT_ACCESS_SECRET_KEY='long-unpredictable-secret1'
JWT_ACCESS_EXPIRATION_TIME='5m'
JWT_REFRESH_SECRET_KEY='long-unpredictable-secret2'
JWT_REFRESH_EXPIRATION_TIME='30d'

# DATABASE
# change if you running in a different way than the one written in docker compose file
DB_TYPE='postgres'
DB_USERNAME='admin'
DB_PASSWORD='admin'
DB_HOST='postgres-main'
DB_PORT=5432
DB_DATABASE='postgres-nest'
DB_SYNC=true

# REDIS
# change if you running in a different way than docker compose
REDIS_HOST='redis-main'
REDIS_PORT=6379

# GOOGLE
OAUTH_GOOGLE_ID=[YOUR_GOOGLE_OAUTH_ID]
OAUTH_GOOGLE_SECRET=[YOUR_GOOGLE_SECRET]
OAUTH_GOOGLE_REDIRECT_URL='/api/v1/auth/google/redirect'

# FACEBOOK
OAUTH_FACEBOOK_ID=[YOUR_FACEBOOK_ID]
OAUTH_FACEBOOK_SECRET=[YOUR_FACEBOOK_SECRET]
OAUTH_FACEBOOK_REDIRECT_URL='/api/v1/auth/facebook/redirect'

0.2. Create .env file in workers/queues root directory and fill with following:

# MAIL
SMTP_USER=[YOUR_SMTP_USER]
SMPT_PASSWORD=[YOUR_SMTP_PASSWORD]

# REDIS
# change if you running in a different way than docker compose
REDIS_HOST='redis-main'
REDIS_PORT=6379

Tip

For free email testing you can use service such as Mailtrap.

With Docker

1. Run Docker containers

docker compose up 

Without Docker

1. Change contents of DATABASE and REDIS sections in env files

server

...

# DATABASE
DB_TYPE=[YOUR_DB_TYPE]
DB_USERNAME=[YOUR_DB_USERNAME]
DB_PASSWORD=[YOUR_DB_PASSWORD]
DB_HOST=[YOUR_DB_HOST]
DB_PORT=[YOUR_DB_PORT]
DB_DATABASE=[YOUR_DB_DATABASE]
DB_SYNC=[true or false in dev mode, false in prod]

# REDIS
REDIS_HOST=[YOUR_REDIS_HOST]
REDIS_PORT=[YOUR_REDIS_PORT]

...

workers/queues

...

# REDIS
REDIS_HOST=[YOUR_REDIS_HOST]
REDIS_PORT=[YOUR_REDIS_PORT]

2.1 Server setup

cd server 
npm install 
# OR 
pnpm install 
# OR 
yarn

2.2 Worker

cd workers/queues
npm install 
# OR 
pnpm install 
# OR 
yarn

3. Client setup

cd client 
npm install 
# OR 
pnpm install 
# OR 
yarn

FEATURES

  • Local login & register
  • Social login & register using Google and Facebook
  • Jwt access token & refresh token
  • Account confirmation
  • Password recover
  • Profile update
  • Multiple themes with the ability to add your own
  • Group chat with basic permissions
  • Private chat (also with yourself)
  • Rate limiting

TECH STACK

  • Backend:
    • Nest.js
    • PostgreSQL
    • Redis
    • WebSockets
    • JWT
    • Passport.js
  • Frontend
    • Next.js
    • Tailwind & DaisyUI
    • Redux (rematch)

TO DO

  • Local login
  • Google login
  • Facebook login
  • Client app routing
  • Write tests for API
  • Password recover & change features
  • Queues
  • Refresh tokens
  • Chat
  • Make URL preview
  • Enable sending images and maybe videos
  • Public profile page
  • Refactor chat backend & UI

License

MIT

nest-next-boilerplate's People

Contributors

poprostuwitold avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.