create-e.x.p.r.re.s.s-app

1.2.10 • Public • Published

CEA (Create Express App)

License npm version

Overview

The CEA (Create Express App) npm package simplifies the setup of a full-stack web application with user authentication. It provides a template Express.js backend and a React frontend, complete with essential middleware for security, authentication, and database interactions. The package aims to streamline the development process, allowing developers to focus on building features rather than dealing with boilerplate code and configuration.

Features

Installation

  1. To reate an Express app, run this command in your project's root folder:

    npx create-e.x.p.r.re.s.s-app

  2. Navigate to the /backend directory and start the server:

    cd backend && npm start

  3. Navigate to the /frontend directory and start the React app:

    cd frontend && npm start

  4. To make changes to the migrations you must unseed and unapply migrations

Configuration

Environment Variables

Environment variables are already included in /backend:

PORT=8000
DB_FILE=db/dev.db
JWT_SECRET=«generate_strong_secret_here»
JWT_EXPIRES_IN=604800
SCHEMA=«custom_schema_name_here»

Database Migration and Seeding

Migrate Database:

Run the following command to perform migrations:

npx dotenv sequelize db:migrate

Seed Database:

Run the following command to seed the database:

npx dotenv sequelize db:seed:all

Unseed Database:

To unseed the database, run:

npx dotenv sequelize db:seed:undo:all

Unmigrate Database:

To unapply migrations, run:

npx dotenv sequelize db:migrate:undo:all

Reapply Migrations and Seeds:

To make changes to migrations, first, unseed and unapply migrations, then reapply and reseed:

npx dotenv sequelize db:seed:undo:all
npx dotenv sequelize db:migrate:undo:all
npx dotenv sequelize db:migrate
npx dotenv sequelize db:seed:all

Deploying to Render:

  1. Create a PostgreSQL Database, name it and choose your region. Copy the Internal DB URL.

  2. Start a new Web Service

  3. Choose your Github repo

  4. Name your web service and choose your region.

  5. Build command

    npm install && npm run render-postbuild && npm run build && npm run sequelize --prefix backend db:migrate && npm run sequelize --prefix backend db:seed:all
  6. Add Environment variables

    PORT=8000
    DB_FILE=db/dev.db
    JWT_SECRET=(click 'Generate')
    JWT_EXPIRES_IN=604800
    SCHEMA=«custom_schema_name_here»
    NODE_ENV=production
  7. Create Web Service

Package Sidebar

Install

npm i create-e.x.p.r.re.s.s-app

Weekly Downloads

2

Version

1.2.10

License

ISC

Unpacked Size

58 kB

Total Files

3

Last publish

Collaborators

  • dudewithoneleg