Skip to content

SpencerFaust/we_sparkle

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Prime Project

This version uses React, Redux, Express, Passport, and PostgreSQL (a full list of dependencies can be found in package.json).

We STRONGLY recommend following these instructions carefully. It's a lot, and will take some time to set up, but your life will be much easier this way in the long run.

Prerequisites

Before you get started, make sure you have the following software installed on your computer:

Create database

Create a new database called prime_app and a collection called person.

Download (Don't Clone) This Repository

  • Don't Fork or Clone. Instead, click the Clone or Download button and select Download Zip.
  • Unzip the project and start with the code in that folder.
  • Create a new GitHub project and push this code to the new repository.

Development Setup Instructions

  • Run npm install
  • Create a .env file at the root of the project and paste this line into the file:
    SERVER_SESSION_SECRET=superDuperSecret
    
    While you're in your new .env file, take the time to replace superDuperSecret with some long random string like 25POUbVtx6RKVNWszd9ERB9Bb6 to keep your application secure. Here's a site that can help you: https://passwordsgenerator.net/. If you don't do this step, create a secret with less than eight characters, or leave it as superDuperSecret, you will get a warning.
  • Start mongo if not running already by using brew services start mongodb
  • Run npm run server
  • Run npm run client
  • Navigate to localhost:3000

Debugging

To debug, you will need to run the client-side separately from the server. Start the client by running the command npm run dev:client. Start the debugging server by selecting the Debug button.

VSCode Toolbar

Then make sure Launch Program is selected from the dropdown, then click the green play arrow.

VSCode Debug Bar

Production Build

Before pushing to Heroku, run npm run build in terminal. This will create a build folder that contains the code Heroku will be pointed at. You can test this build by typing npm start. Keep in mind that npm start will let you preview the production build but will not auto update.

  • Start postgres if not running already by using brew services start postgresql
  • Run npm start
  • Navigate to localhost:5000

Lay of the Land

  • src/ contains the React application
  • public/ contains static assets for the client-side
  • build/ after you build the project, contains the transpiled code from src/ and public/ that will be viewed on the production site
  • server/ contains the Express App

This code is also heavily commented. We recommend reading through the comments, getting a lay of the land, and becoming comfortable with how the code works before you start making too many changes. If you're wondering where to start, consider reading through component file comments in the following order:

  • src/components
    • App/App
    • Footer/Footer
    • Nav/Nav
    • AboutPage/AboutPage
    • InfoPage/InfoPage
    • UserPage/UserPage
    • LoginPage/LoginPage
    • RegisterPage/RegisterPage
    • LogOutButton/LogOutButton
    • ProtectedRoute/ProtectedRoute

Deployment

  1. Create a new Heroku project
  2. Link the Heroku project to the project GitHub Repo
  3. Create an Heroku Postgres database
  4. Connect to the Heroku Postgres database from Postico
  5. Create the necessary tables
  6. Add an environment variable for SERVER_SESSION_SECRET with a nice random string for security
  7. In the deploy section, select manual deploy

Update Documentation

Customize this ReadMe and the code comments in this project to read less like a starter repo and more like a project. Here is an example: https://gist.github.com/PurpleBooth/109311bb0361f32d87a2

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 84.4%
  • CSS 14.4%
  • HTML 1.2%