Full Stack Starter Kit, using NodeJS for server.
The Earthling Interactive Full Stack Starter Kit project provides a starting point for a full-stack node application with a rich front-end framework. It also includes related technologies to make development and deployment easier, such as bundling, testing, and containerization.
First, clone the project. Copy server/.env.example
to server/.env
and client/.env.example
to client/.env
Run the following command:
$ docker-compose up -d
This spins up a postgres instance, starts client at http://localhost:3000
and starts server at http://localhost:4000
.
Server calls are proxied, so http://localhost:3000/api/users
will hit http://localhost:4000/api/users
automagically.
To init the database:
docker exec -it fssk-server npm run migrate && npm run seed
Log in to the todo app with test@earthlinginteractive.com
, password test
.
The current technologies used by fssk are as follows:
Type | Selected Technology | Reasoning |
---|---|---|
Transpiler | TypeScript | Static types make for code that is less buggy and easier to reason about. A basic TypeScript cheatsheet can be found here and more extensive documentation here and here |
View Library | React | Component-based views that encourage single-directional data flow |
Client-side State Management | MobX | Simpler than Redux and requires less boilerplate |
Backend Server | Express | Well documented and widely supported web framework |
API Protocol | REST | A familiar paradigm to most developers |
Data Mapping Framework | bookshelf.js | An easier to use ORM framework than Sequelize, based on Knex.js |
Database Migrations | Knex.js Migrations | Provided by knex.js, so no additional dependencies |
Data Store | PostgreSQL | Open source, rock solid, industry standard |
Package Manager | npm | The battle-tested choice for node development |
Containerization | Docker | Containers make deployment easy |
Testing Framework | Jest | Complete testing package with an intuitive syntax |
Linter | tslint | Keeps your TypeScript code consistent |
- Docker
See Getting Started section for steps.
Once spun up, you can shell into the client or server instances like:
docker exec -it fssk-client bash
docker exec -it fssk-server bash
Build client side code:
cd client/ && npm run build
docker-compose -f docker-compose-prod.yml up -d
Will build the client code, spin up the server in a docker instance with / pointing to client's index.html.
See the .env.example files in client and server directories.
Client and Server code each have their own tests, using Jest. Shell into container and run:
npm test
TBD
TBD
Using postgres v9.6. For local development, database runs in docker container. db
folder contains
init scripts, and server/db_migrations
contains additional migrations and seeds.
You can connect to the database with your favorite client at localhost:5432
!
Make sure git globally has line endings set to LF. This needs to be set before cloning the project.
- For windows:
git config --global core.autocrlf false
- For linux/mac:
git config --global core.autocrlf input
If you forget to do this in windows, you make get errors starting docker like file not found
.
Update the line endings of any files that are crlf to lf and try again
You should be able to run the site locally without docker if desired. Make
sure you have node >= v8.9.4. You will need to change the client proxy in
client/package.json
to point to http://localhost:4000
, and the POSTGRES_HOST
in server/.env
to localhost
.