The goal of this project is to make a blank web application with authentication and tests. It can be used as an template for starting a new project on Clojure or for learning Clojure.
Merge requests to this project are welcome!
Just in case you are curious how it looks when started
- [Leiningen][https://github.com/technomancy/leiningen] 2.0.0 or above installed.
- PostgreSQL
- Registration
- Login
- Profile page with ability to update the password and remove the account
- PostgreSQL database with migrations
- Layout with Bootstrap CSS and jQuery
- Send email confirmation on signup (optional)
- Avatar upload
- add remember me checkbox for authentication
- add forget password feature
Create the database:
createdb sample
To start a web server for the application, run:
lein ring server
Now visit http://localhost:3000/ to see the app running.
The repository contains the Dockerfile
. You can build and run the app with Docker.
App will be running on port 5000
by default. Database is not included.
So make sure to pass a DATABASE_URL
to the container.
Clone the repository and cd into it. Then execute next commands:
heroku create
heroku addons:create heroku-postgresql:hobby-dev
git push heroku main
heroku open
The last command should open the application in your browser.
Application reads the DATABASE_URL
environment variable for the database connection.
If none provided, it will use the default value from src/sample/db.clj
.
Migrations are run automatically when you start the app or tests. If you need to manually run migrations, you can use next command:
lein migratus migrate
To run tests you need to setup a test database
# create a separate database for tests
createdb sample-test
# run tests
DATABASE_URL=postgresql://localhost:5432/sample-test lein test