This is my fun little project. It is built using a skeleton cloned from [https://github.com/glebec/bones]. I will be putting all my project works and my contact info on this page.
To start:
npm install
npm run dev
The dev
script sets NODE_ENV
to "development", runs the build script in watch mode, and
starts the server with nodemon
. Build vs server logs are separated by a prefix. If you prefer
to run the server and build processes separately, you can instead do:
npm run start-dev
npm run build-dev
In two separate terminals. The vanilla npm start
is for production — you won't use it in development!
/app
has the React/Redux setup. main.jsx
is the entry point.
/db
has the Sequelize models and database setup. It'll create the database for you if it doesn't exist,
assuming you're using postgres.
/server
has the Express server and routes. start.js
is the entry point.
/bin
has scripts. (Right now it has one script that creates a useful symlink.)
I use require
and module.exports
in .js
files.
I use import
and export
in .jsx
files, unless require
makes for cleaner code.
I use two spaces, no semi-colons, and trailing commas where possible. I'll have a linter someday soon.
- Set up the Heroku command line tools and install Yarn if you haven't already (
npm install -g yarn
) heroku login
- Add a git remote for heroku:
-
If you're creating a new app...
heroku create
orheroku create your-app-name
if you have a name in mind.heroku addons:create heroku-postgresql:hobby-dev
to add postgresnpm run deploy-heroku
. This will create a new branch and compile and commit your frontend JS to it, then push that branch to Heroku.heroku run npm run seed
to seed the database
-
If you already have a Heroku app...
heroku git:remote your-app-name
You'll need to be a collaborator on the app.
Afterwards,
- To deploy:
npm run deploy-heroku
- To re-seed:
heroku run npm run seed