Skip to content

sansarip/gh-repo-list

Repository files navigation

Build Status

GH Repo List

An example project mocking a GitHub repo list that uses my full stack Clojure web app template. You should read this document top down in the order presented. When you get to Development Mode, then you may choose to instead skip that section and jump to Production Build.

Preview
Application FSM

where

t = template

r = repositories

Spinning up the DB

Prerequisites

  1. Create a .env file in the root directory of this project.
  2. Navigate to the root directory of this project and execute echo 'MYSQL_ROOT_PASSWORD=<yourpassword>' >> .env.
  3. While still in the root directory, spin up the MySQL DB by running make start-db.
  4. After a little while the MySQL DB will initialize along with Adminer; navigate to localhost:8080 and log in with the password you set in step two.
  5. You should now be able to see the dummy data located within two tables in the TestApp database.

Before you run

The application will read the database connection info from your system environment variables. The defaults should be ok, other than the password.

Run export MYSQL_DATABASE_PASSWORD=<yourpassword> before moving on to run the application.

Here's a full list of the database connection environment variables if you need to change them for some reason.

NAME DEFAULT VALUE REQUIRED
MYSQL_DATABASE_DBNAME TestApp No
MYSQL_DATABASE_HOST localhost No
MYSQL_DATABASE_PORT 3306 No
MYSQL_DATABASE_USER root No
MYSQL_DATABASE_PASSWORD password Yes
MYSQL_DATABASE_POOL_SIZE 20 No

Development Mode

Prerequisites

Run this once

yarn webpack

Yarn and webpack are only necessary because I added literal confetti 🎉

Then run this

lein clean
lein fig:dev

Our pal Figwheel Main or Figgy Smalls as I like to call it will spin your application right up for you with auto-refresh capabilties n' all!

Wait a bit, then browse to http://localhost:9500.

But wait, there's more! I dunno about you, but I love constructing small, reusuable components that then compose the entirety of the site like lego bricks. What helps with that? Devcards!

You can view your devcards at http://localhost:9500/devcards.html.

Want to test your cljs? Visit http://localhost:9500/figwheel-extra-main/auto-testing and see your test turn from red to green!

Production Build

Prerequisites

  • Same prereqs as dev
  • Make sure you've run yarn webpack at least once prior
lein clean
lein prod

That should compile the ClojureScript code first, and then create the standalone jar which you can then run with java -jar target/my-website.jar

Your website will be awaiting you at localhost:3000

You can change the port by specifying the JETTY_PORT=<yourport> env variable

Cheers! 🍻

About

An example full stack Clojure project

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages