Skip to content

CalHoll/t3-lab

Repository files navigation

T3 Sample

This is a sample project using the T3 stack (details below). This project was made as simple as possible while still showing an approach that scales.

Essentially, this project is a dynamic form creator. Currently it expects only two questions to be presented, the first being a radio button, and the second being a multi-select checkbox.

The second question is dynamic based on the first, and the result is dynamic based on customizable logic that is included in the JSON data.

It was designed this way to make it easy for other forms and data to be added in the future.

Bootstrapped with Create-T3-App

This is a T3 Stack project bootstrapped with create-t3-app. Some of the technologies used include:

To learn more about the T3 Stack, check out the following resources:

Setup and Development

Local Development

Install dependencies:

    npm install

Start server locally:

    npm run dev

Open a web browser and navigate to http://localhost:3000/.

How is this deployed?

The app is deployed via Vercel, you can find the current version at https://t3-pdky091qg-calholl.vercel.app

For info on how deployment works, find the Vercel guide here.

WIP - Running In Docker

Currently the app can also run in Docker, though the DB is included in the compose file and is currently a WIP.

For more info about the app working with docker see the T3 Docker guide here.

WIP - Setting up the DB

The next step for this project is to connect it to a postgres database. Currently postgres can be spun up using docker, either as a standalone image or networked to a production app version with:

    docker compose up

For development and testing with a database locally, some useful commands follow:

    # get image
    docker pull postgres

    # Run image
    docker run --name t3-sandbox-postgres -p 5432:5432 -e POSTGRES_PASSWORD=mysecretpassword -d postgres

    # Connect to local pg
    psql -h localhost -p 5432 -U postgres -W

    # Create db
    CREATE DATABASE t3_sandbox;

    # exit psql
    \q

    # create prisma tables
    npx prisma db push

    # connect to prisma studio
    npx prisma studio