Skip to content

Messaging app to practice role-based authentication and actions

Notifications You must be signed in to change notification settings

strallia/members-only

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

54 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Members Only

Home page

Purpose

To practice authentication with PassportJS using Local Strategy by creating a message board app where users can have a role of Basic, Premium, or Admin each with different visibilities and CRUD settings.

Built with: Express, Node, PostgreSQL, EJS, Figma, PassportJS

Forms

Login Signup Upgrade Role
Login form Signup form Upgrade role form

User Role Views

Basic Premium Admin
Basic user Premium user Admin user

Features

  • Protects passwords using bcrypt for hashing and salting
  • Prevents unauthenticated users from accessing protected routes
  • Restrict access to certain CRUD functionalities based on the user's role
  • Server-side validation and sanitization of form inputs
  • Change user role with secret passwords

Database Schema

Database schema diagram

Figma Designs

Figma designs

Getting Started

Follow these steps to get the application running locally on your system.

  1. Make sure you have the following installed on your system:
  • Node.js (version 20.15.1 or higher)
  • PostgreSQL client to interact with the database
  • Any code editor (e.g. VS Code)
  1. In a terminal, clone the repository
  git clone https://github.com/strallia/members-only.git
  1. Navigate to the project directory
cd members-only
  1. Install Dependencies
npm install
  1. Create a .env file in the root directory of the project and add the following environment variables, replacing the values inside < > with your own credentials:
DATABASE_URL="postgresql://<dbuser>:<secretpassword>@localhost:5432/members_only"
SESSION_SECRET="superSecretSessionPassword"

# Secret passwords for role upgrades
ADMIN_PASS="<any password>"
PREMIUM_PASS="<any password>"
  1. Start the Development Server
npm start

This will launch the app at http://localhost:3000.

About

Messaging app to practice role-based authentication and actions

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published