Skip to content

A basic template for a back-end application that, when combined with a front-end template, can aid in constructing PERN stack apps that utilize JWT authentication. This template utilizes CommonJS modules.

Notifications You must be signed in to change notification settings

SEI-Remote/decoupled-pern-jwt-auth-template-back-end-cjs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Decoupled PERN Stack with JWT Auth Template - Back End

This is the back end of a decoupled PERN Stack app that includes JWT Authentication.

When combined with the front end found here, you'll have all you need to build a full stack PERN app!

Use this to go build things! 🚀

To Use This Template

Replace <name-of-your-app-here> (including the < and >) in the commands below with the name of your app!

git clone https://github.com/SEI-Remote/decoupled-pern-jwt-auth-template-back-end-cjs <name-of-your-app-here>-back-end
cd <name-of-your-app-here>-back-end
code .

With the project open in VS Code, open a terminal and run:

rm -rf .git

Here's what your command line output should like after this step (note that the indicator that we are in a git repository is gone!)

The command line before and after running the rm -rf .git command. Before git:(main) is visible indiating that the directory contains a git repository, after the command it is not.

Re-initialize a git repository:

git init

Create a repo for this project on GitHub and add that remote to your project with (replacing your-repo-URL-here with the URL of the repo you just created):

git remote add origin your-repo-URL-here

Run npm i to fetch the template's dependencies:

npm i

touch a .env file:

touch .env

Fill it with the following:

DATABASE_URL=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
SECRET=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
CLOUDINARY_URL=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Replace the DATABASE_URL, SECRET, and CLOUDINARY_URL with values that you provide.

🚨 Place secrets in this .env file. The contents of this file WILL NOT be exposed to site visitors.

Make your first migration to create the built-in User and Profile tables in your database:

sequelize-cli db:migrate

Confirm the app starts up with:

nodemon

Delete this README.md, then make an initial commit:

git add .
git commit -m "initial commit"
git push origin main

Launch the app with:

nodemon

You're done!

About

A basic template for a back-end application that, when combined with a front-end template, can aid in constructing PERN stack apps that utilize JWT authentication. This template utilizes CommonJS modules.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published