{"id":13700919,"url":"https://github.com/olliecoleman/alloy","last_synced_at":"2025-05-04T19:33:51.008Z","repository":{"id":57486660,"uuid":"102855734","full_name":"olliecoleman/alloy","owner":"olliecoleman","description":"Boilerplate for creating web applications in Go (golang)","archived":false,"fork":false,"pushed_at":"2017-11-30T16:38:31.000Z","size":494,"stargazers_count":369,"open_issues_count":6,"forks_count":28,"subscribers_count":18,"default_branch":"master","last_synced_at":"2024-08-03T20:10:34.915Z","etag":null,"topics":["golang","web-app","webpack"],"latest_commit_sha":null,"homepage":"https://www.growthmetrics.io/open-source/alloy","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/olliecoleman.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-09-08T11:45:38.000Z","updated_at":"2024-07-09T09:50:16.000Z","dependencies_parsed_at":"2022-09-01T20:31:28.188Z","dependency_job_id":null,"html_url":"https://github.com/olliecoleman/alloy","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/olliecoleman%2Falloy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/olliecoleman%2Falloy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/olliecoleman%2Falloy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/olliecoleman%2Falloy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/olliecoleman","download_url":"https://codeload.github.com/olliecoleman/alloy/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224406065,"owners_count":17305718,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["golang","web-app","webpack"],"created_at":"2024-08-02T20:01:08.520Z","updated_at":"2024-11-13T06:31:34.983Z","avatar_url":"https://github.com/olliecoleman.png","language":"Go","funding_links":[],"categories":["Go"],"sub_categories":[],"readme":"# Alloy\nAlloy is a starter template for creating web applications using Go programming language.\nIt does not aim to be a web framework but is instead a collection of useful libraries and packages that acts a sensible starting point.\n\nRecently, I decided to build my latest [side project](https://www.growthmetrics.io) using Go. I started off with just the standard library and then gradually added a few recommended packages for performing common tasks like database calls (sqlx), migrations (pressly/goose) and sending emails (gomail). This boilerplate has been extracted from that side project. \n\nAlloy uses **Webpack** for managing front-end assets (Javascript and CSS), so you need to have Node.js and NPM installed in order to use that. This boilerplate also includes a separate 'admin panel' which acts as a CMS for adding pages, managing users etc.\n\n\u003e *\\\u003cshameless plug\u003e* GrowthMetrics is a nifty little tool to measure your business's customer satisfaction using a metric called NPS (Net Promoter Score). You can signup for the early access (and early bird discount) here - [https://www.growthmetrics.io/beta](https://www.growthmetrics.io/beta).\n\n\n** NOTE: ** Currently this uses Postgres as the database, so you would need postgres to be running before you start the application. In future releases, I will be adding support for other databases.\n\n### Packages used\n- go-chi/chi\n- lib/pq\n- jmoiron/sqlx\n- markbates/pop/nulls\n- gorilla/sessions\n- gorilla/csrf\n- gorilla/securecookies\n- markbates/refresh\n- microcosm-cc/bluemonday\n- pkg/errors\n- pressly/douceur\n- pressly/goose\n- satori/go.uuid\n- spf13/cobra\n\n\n### Available commands\n\n```\nUsage:\n  alloy [command]\n\nAvailable Commands:\n  db          Manage the app's database (create migration, migrate up/down/redo).\n  dev         Start the development server (along with webpack watch)\n  gen-key     Generate a random key to use with securecookies\n  help        Help about any command\n  new-admin   Manage the admin user(s)\n  server      Start the server\n  version     Print the version number of alloy\n```\n\n### Installation and usage\n\n1. Clone the repository\n```\ngit clone https://github.com/olliecoleman/alloy\ncd alloy\n```\n\n2. Install the dependencies\n```\nglide install\nnpm install\n```\n\n3. Create the following environment variables.\n```\nPORT=1212\nENVIRONMENT=development (change to 'production' in the production environment)\nHOST=localhost\nDATABASE_URL=XXX (replace)\nTEST_DATABASE_URL=XXX (replace)\nMIGRATIONS_DIR=app/migrations\nCSRF_KEY=XXX (replace with 32 character string (use the gen-key command))\nHASH_KEY=XXX (replace with 64 character string (use the gen-key command))\nBLOCK_KEY=XXX (replace with 32 character string (use the gen-key command))\nSMTP_HOST=127.0.0.1\nSMTP_PORT=1025\nSMTP_USERNAME=__REPLACE__\nSMTP_PASSWORD=__REPLACE__\nMAILER_FROM=XXX (e.g: support@alloy.dev)\nMAILER_HOST=http://localhost:1212\nASSET_URL=http://localhost:1212 (if you are using a CDN in production, this can be set to that URL)\n```\n\n3. Start the development server\n```\ngo install\nalloy dev\n```\n\nNow you can open your browser and navigate to http://localhost:1212 to see it in action. Any changes you make to the .go files will be automatically picked up and the app will be re-compiled.\n\n\n### Project structure\n\n```\n    ├── README.md\n    ├── app\n    │   ├── handlers\n    │   ├── mailer\n    │   ├── migrations\n    │   ├── models\n    │   ├── router\n    │   │   ├── middleware\n    │   │   └── router.go\n    │   ├── services\n    │   │   ├── db.go\n    │   │   └── session.go\n    │   ├── templates\n    │   │   ├── admin\n    │   │   ├── layouts\n    │   │   ├── mailer\n    │   │   ├── pages\n    │   └── views\n    ├── assets\n    │   ├── fonts\n    │   ├── images\n    │   ├── js\n    │   └── scss\n    │       ├── admin\n    │       ├── frontend\n    │       └── frontend.scss\n    ├── cmd\n    ├── testutils\n    ├── glide.yaml\n    ├── main.go\n    ├── package.json\n    ├── refresh.yml\n    └── webpack.config.js\n```\n\n\n### Screenshots\n\n\u003cdiv align=\"center\"\u003e\n  \u003cimg src=\"./assets/images/home.jpg\" alt=\"Home page\"\u003e\n\u003c/div\u003e\n\n\u003cdiv align=\"center\"\u003e\n  \u003cimg src=\"./assets/images/contact.jpg\" alt=\"Contact page\"\u003e\n\u003c/div\u003e\n\n\u003cdiv align=\"center\"\u003e\n  \u003cimg src=\"./assets/images/dashboard-1.jpg\" alt=\"Dashboard\"\u003e\n\u003c/div\u003e\n\n\u003cdiv align=\"center\"\u003e\n  \u003cimg src=\"./assets/images/dashboard-2.jpg\" alt=\"Dashboard\"\u003e\n\u003c/div\u003e\n\n----------\n\nIf you have any questions or comments, please get in touch via email or open an issue. I would welcome your suggestions and pull requests. \n\n\nOliver Coleman\u003cbr\u003e\ncoleman.oliver[at]icloud[dot]com\u003cbr\u003e\nhttps://www.growthmetrics.io","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Folliecoleman%2Falloy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Folliecoleman%2Falloy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Folliecoleman%2Falloy/lists"}