moolah
Track your finances.
Developing
Pre-requisites
Installation
Clone this repository.
git clone [email protected]:jmeas/moolah.git
Navigate to the root directory of this project, and install the npm dependencies.
cd moolah && npm install
Setting up the Database
Running this project locally requires a Postgres database. The easiest way to do this is to create a Heroku application with the Postgres Heroku add-on. Then, we can just use that project's database. If you're comfortable setting up your own database, then feel free to do that.
To use the Heroku method, begin by deploying the app by following the instructions above.
Once that's done, you'll need to hook up your local repository with the Heroku app that you just created by adding the app as a remote. This guide can help you do that.
.env
file
For local development, secrets are stored in an .env
file in the project root.
The values are:
DATABASE_URL
: the DB URL to connect to (see below for how to get this)SESSION_SECRET
: the secret used by express-sessionGOOGLE_CLIENT_ID
: the ClientID of a Google projectGOOGLE_CLIENT_SECRET
: the secret of the above projectGITHUB_CLIENT_ID
: the ClientID of a GitHub applicationGITHUB_CLIENT_SECRET
: the secret of the above projectFACEBOOK_CLIENT_ID
: the ClientID of a Facebook applicationFACEBOOK_CLIENT_SECRET
: the secret of the above projectTWITTER_CLIENT_ID
: the ClientID of a Twitter applicationTWITTER_CLIENT_SECRET
: the secret of the above project
The different social media IDs and Secrets enable logging in via those social networks. Right now, they are all necessary to run this app locally.
An example snippet from an .env
file is:
DATABASE_URL='postgres://whatevs'
SESSION_SECRET='cookies_are_delicious'
The .env
file is not used when deploying the app to Heroku. Instead, use the
Heroku Dashboard to modify the environment variables of the deployed webapp.
Getting the database URL
If you followed the instructions above for setting up the local DB, then you can
get the database URL by running heroku config -s
from the project's root
directory.
Local development
Once you've followed the installation and database setup instructions above, you're ready to run the app locally. Follow these steps:
- Start up Postgres
- Run
npm run local-server
to start the Express app - Run
npm run watch
to build the JS & CSS, and set up the file watcher
The app should now be available in your browser at http://localhost:5000
.
Developer Scripts
npm run watch
: Build the JavaScript & CSS, and set up a watchernpm run local-server
: Starts the development web server. Restarts the server if it dies.npm run test
: Lint JS & CSS, then run all unit testsnpm run lint
: Lint the JavaScript and CSS filesnpm run test-browser
: Builds the app to run the tests in a local browsernpm run watch-tests
: Run the tests in Node. Then start a watch task to re-run them if you make any changes.npm run build
: Build a production version of the applicationnpm run coverage
: Generate a coverage reportnpm run sync
: Run the SQL scripts in./migrations
npm run release
: Release a new version of the production app by syncing production with stagingnpm run minify-emoji
: Compress the file located atserver/static/sheet_apple_64.png
Deploying
The Production App
The production version of this app is deployed as part of a Heroku pipeline. Only users with access to the Heroku app will be able to deploy it.
The release flow is as follows:
- Opening a PR automatically creates a Review App
- Merging to the
master
branch will automatically deploy the staging app - Running
npm run release
will promote the staging app to production*
* Note: the name of the Heroku remote must be staging
for this command to work.
Custom
You can deploy your own version of Moolah, too. This app is in very early development, so it doesn't fully function. Keep that in mind if you wish to deploy it!
The preferred method to deploy this app is through Heroku. To enable logging in, you'll need to set up a Google project with the Google+ API enabled.
You'll then need to a similar process for Twitter, Facebook, and GitHub.
Once you've gotten all of your ClientIDs and Secrets, click the button below:
Target browser support
Evergreen browsers (including Microsoft Edge). No Internet Explorer support.
Updating the Emoji
This application uses js-emoji, the same library that Slack uses, for emoji rendering. Sometimes when updating that dependency, the emoji will change. When that happens, we need to manually update image files in this project.
This is because js-emoji
doesn't minify the spritesheets. To minify them, this
project uses imagemin
.
First, download the updated assets from js-emoji
. Then, copy the
sheet_apple_64.png
file into the server/assets
directly. Lastly, run:
npm run minify-emoji