{"id":22704047,"url":"https://github.com/omfj/stacc-code-challenge-spring-2023","last_synced_at":"2026-04-15T18:31:41.121Z","repository":{"id":133666064,"uuid":"591433820","full_name":"omfj/stacc-code-challenge-spring-2023","owner":"omfj","description":"⚡Stacc Code Challenge Spring 2023","archived":false,"fork":false,"pushed_at":"2023-06-20T21:56:56.000Z","size":525,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-29T20:12:04.266Z","etag":null,"topics":["nextjs","planetscale","t3-stack","tailwindcss","trpc"],"latest_commit_sha":null,"homepage":"https://stacc.omfj.no","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/omfj.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-01-20T18:44:47.000Z","updated_at":"2023-02-05T16:04:24.000Z","dependencies_parsed_at":null,"dependency_job_id":"13b69c6a-28fc-43e7-9ebf-ec9afe85647c","html_url":"https://github.com/omfj/stacc-code-challenge-spring-2023","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/omfj/stacc-code-challenge-spring-2023","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/omfj%2Fstacc-code-challenge-spring-2023","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/omfj%2Fstacc-code-challenge-spring-2023/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/omfj%2Fstacc-code-challenge-spring-2023/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/omfj%2Fstacc-code-challenge-spring-2023/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/omfj","download_url":"https://codeload.github.com/omfj/stacc-code-challenge-spring-2023/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/omfj%2Fstacc-code-challenge-spring-2023/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31854667,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-15T15:24:51.572Z","status":"ssl_error","status_checked_at":"2026-04-15T15:24:39.138Z","response_time":63,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["nextjs","planetscale","t3-stack","tailwindcss","trpc"],"created_at":"2024-12-10T08:13:37.405Z","updated_at":"2026-04-15T18:31:41.104Z","avatar_url":"https://github.com/omfj.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Stacc Code Challenge Spring 2023\n\nThis is my submission for the [Stacc Code Challenge Spring 2023](https://github.com/stacc/future-of-fintech-V2023).\n\nedit: I won! 🥳\n\n## Technology\n\nThis application uses the t3-stack as a template because it reduces the amount\nof time I have to spend setting up the project. Also, it has all the\ngreat technologies I love, mainly NextJS, TailwindCSS, tRPC and TypeScript.\nThe database is hosted on [Planetscale](https://planetscale.com/).\n\n## API\n\nAPI for energy prices in Norway is provded by [Hva koster strømmen.no](https://www.hvakosterstrommen.no/strompris-api).\n\n## How to run\n\nJust [visit the website!](https://stacc.omfj.no) (Website is taken down, because I need that free Planetscale thing)\n\nBut if you want to build the app locally follow these steps:\n\nPrerequisites: `git`, `node` (v16.19.x) and `pnpm` (or `yarn` or `npm`)\n\nDepending on the setup: `docker` and `docker-compose` might also be required.\n\n### Download and install the repo\n\n1. Clone the repository\n\n   ```sh\n   git clone https://github.com/omfj/stacc-code-challenge-spring-2023\n   ```\n\n2. `cd` into the directory and install dependencies\n\n   ```sh\n   cd stacc-code-challenge-spring-2023\n   pnpm install\n   ```\n\n3. Copy `.env.example` to `.env`\n\n   ```sh\n   cp .env.example .env\n   ```\n\n### Setting up auth\n\n1. Create a [GitHub OAuth app](https://github.com/settings/developers)\n2. Paste the credentials in the `.env` file. `GITHUB_CLIENT_ID` and `GITHUB_CLIENT_SECRET` respectively.\n\n### Database\n\n#### Locally\n\n1. Run `docker-compose up --build` in the root of this directory. This will create a docker container with a MySQL database locally on your machine.\n2. Make sure the `DATABASE_URL` in your `.env` is correct. It should be `mysql://admin:password@localhost:3306/stacc-energy-challenge`\n\n\u003e Remember to run `docker-compose down` when you're done, so it doesn't occupy any ports that you might need later.\n\n#### With Planetscale\n\n1. Create a free [Planetscale database](https://planetscale.com/)\n2. Paste the connection URL in the `DATABASE_URL` field.\n\n### Running the application\n\nTo run the dev environment, use the command below. If you don't use `pnpm`, replace `pnpm` with whatever package manager.\n\n#### Development mode\n\n```sh\npnpm dev\n```\n\n#### Production \"mode\"\n\n1. Build the application\n\n   ```sh\n   pnpm build\n   ```\n\n2. Start it\n\n   ```sh\n   pnpm start\n   ```\n\n## Notes\n\n### Show loading when fetching electricity prices\n\nFetching the electricity prices _CAN_ be slow if you are trying to fetch a price that has not been fetched by anyone before you. Once they have been fetched one time, it will be fast. This is, because of caching done on the server.\n\n### CMS for providers\n\nMake it easier to add/remove/update providers. Could use an external CMS like Sanity, or make my own local. For now, you just have to use `pnpm prisma studio` and add one manually.\n\n### Different plans for different regions\n\nNow all provider plans are in all regions, but realistically they would only be in some of them. So a plan should probably have an `operatingRegion` field with a `PriceRegion[]`.\n\n### Responsiveness\n\nI have made an effort to make the website responsive, but I still don't think the graph looks that good.\n\n## Screenshots\n\n\u003ctable\u003e\n   \u003ctr\u003e\n      \u003ctd align=\"center\"\u003e\n         \u003cimg height=\"300\" src=\"/assets/stromsta-home.png\" /\u003e\n         \u003cbr\u003e\n         \u003csub\u003e\u003cb\u003eHome page\u003c/b\u003e\u003c/sub\u003e\n      \u003c/td\u003e\n   \u003c/tr\u003e\n   \u003ctr\u003e\n      \u003ctd align=\"center\"\u003e\n         \u003cimg height=\"300\" src=\"/assets/stromsta-compare.png\" /\u003e\n         \u003cbr\u003e\n         \u003csub\u003e\u003cb\u003eCompare prices\u003c/b\u003e\u003c/sub\u003e\n      \u003c/td\u003e\n   \u003c/tr\u003e\n   \u003ctr\u003e\n      \u003ctd align=\"center\"\u003e\n         \u003cimg height=\"300\" src=\"/assets/stromsta-profile.png\" /\u003e\n         \u003cbr\u003e\n         \u003csub\u003e\u003cb\u003eProfile page\u003c/b\u003e\u003c/sub\u003e\n      \u003c/td\u003e\n   \u003c/tr\u003e\n\u003c/table\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fomfj%2Fstacc-code-challenge-spring-2023","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fomfj%2Fstacc-code-challenge-spring-2023","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fomfj%2Fstacc-code-challenge-spring-2023/lists"}