Code Monkey home page Code Monkey logo

remix-prisma-example's Introduction

Remix - Prisma - Postgres example app

This is a fairly small example app, but we feel like we've done a good job of stressing the capabilities of Prisma interactions in such a way that we need to break the rules.

The app is a league - game tracker. So, games have a game time + home team + away team. Simple, uh?

We complicated the app-to-database connection in a few ways:

  1. Time zone complication. When querying, for a specific date a person in Europe has a different "day" than a person in Asia. Thus, the views, app, and database all have to agree how dates will be managed.
  2. As of the creation of this application, you cannot pass SQL functions to a Prisma select. Thus, to extract the unique days from the datetime game values, it is fastest to use raw SQL.

Additionally, we added some good best-practices to this application:

  1. Enhanced Postgres logging. We want to see the queries that Prisma generates and executes.

Installation

  1. Pull down repo
  2. Install libraries: npm install
  3. Run Postgres: initdb -D data; postgres -D data
  4. Run Prisma migrations: npx prisma db push
  5. Seed data: node --require esbuild-register prisma/seed.ts
  6. Run development: npm run dev
  7. Open app in your browser: http://localhost:3000/games

remix-prisma-example's People

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.