Files
tech-tracker-next/README.md
2025-06-19 13:49:25 -05:00

4.8 KiB


Tech Tracker Logo
Tech Tracker

Find Here

  • Application used by COG employees to update their status & location throughout the day.

How to run:

Clone the Repository & Install Dependencies

git clone https://git.gbrown.org/gib/tech-tracker-next.git
cd tech-tracker-next

I would recommend using pnpm to install dependencies.

pnpm install

You will also need docker installed on whatever host you plan to run the Supabase instance from, whether locally, or on a home server or a VPS or whatever. Or you can just use the Supabase SaaS if you want to have a much easier time, probably. I wouldn't know!

Add your environment variables

Copy the example environment variable files and paste them in the same directory named .env.

cp ./env.example ./.env
cp ./src/server/docker/env.example ./src/server/docker/.env

Add your secrets to the .env files you just copied.

Host Supabase Locally

  • Follow the instructions here to host Supabase with Docker.
    • You will need to make sure you have some way to connect to the postgres database from the host. I had to remove the database port from the supabase-pooler and add it to the supabase-db in order to directly connect to it. This will be important for generating our types. This is not strictly necessary, and honestly I think I may even just have the docker compose set up to do this already, as I can't figure out why I would want to port to the spooler open on my host anyways.

Create your database schema & generate your types.

  • Copy the contents of the schema file located in ./src/server/db/schema.sql & paste it into the SQL editor on the Web UI of your Supabase instance. Run the SQL. There should be no errors & you should now be able to see the profiles & statuses tables in the table editor.
cat ./src/server/db/schema.sql | wl-copy # If you are on Linux
  • Generate your types.
    • This can be a bit weird depending on what your setup is. If you are running Supabase locally on the same host that you are running your dev server, then this should be straightforward. If you are using the Supabase SaaS, then this is even more straightforward. If you are like me, and you are connecting to a self hosted instance of Supabase on your home server while developing, then you must clone this reposity on your server so that the command line tool can generate the types from your open postgres port on your Host, which is why the docker compose is configured how it was & why I mentioned this earlier.

You will need to run the supabase cli tool with sudo in my experience. What I would recommend to you is to run the command

sudo npx supabase --help

You will be prompted to install the supabase cli tool if you do not already have it installed, which you probably don't since root is running this. After that, you can run the following command below, replacing the password and the port to match your own Supabase Postgres Database port & password.

sudo npx supabase gen types typescript \
--db-url "postgres://postgres:password@localhost:5432/postgres" \
--schema public \
> ./src/utils/supabase/types.ts

There is also a script in the scripts folder called generate_types which should do this for you.

./scripts/generate_types

Start your development environment.

Run

pnpm dev

to start your development environment with turbopack

You can also run

pnpm dev:slow

to start your development environment with webpack

Start your Production Environment.

There are Dockerfiles & docker compose files that can be found in the ./scripts/docker folder for the Next.js website. There is also a script called reload_container located in the ./scripts/ folder which was created to quickly update the container, but this will give you a better idea of what you need to do. First, build the image with

sudo docker compose -f ./scripts/docker/production/compose.yml build

then you can run the container with

sudo docker compose -f ./scripts/docker/production/compose up -d

Now, you may end up with some build errors. The reload_containers script swaps out the next config before it runs the docker build to skip any build errors, so you may want to do this as well, though you are welcome to fix the build errors as well, of course!

Fin

I am sure I am missing a lot of stuff so feel free to open an issue if you have any questions or if you feel that I should add something here!