Skip to content

Latest commit

 

History

History

halprin-web-app

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

halprin-web-app

build

Intro

Halprin web app

Quick start

For rest/api database access be sure to start docker-compose up database, see detailed instructions (seeding, docker, supabase...) in the @contredanse/db-main README.

$ yarn install
$ cd apps/web-app
$ yarn dev

Features

Some common features that have been enabled to widen monorepo testing scenarios.

  • Api routes: some api routes for rest.
  • I18n: based on next-i18next
  • Styling: Emotion support with critical path extraction enabled.
  • Styling: Tailwind with JIT mode enabled and common plugins.
  • Security: next-secure-headers with basic defaults.
  • Seo: next-seo
  • Tests: Jest with ts-jest enabled

Database access for api's and server-side rendered

Monorepo deps

This app relies on packages in the monorepo, see detailed instructions in README.md

{
  dependencies: {
    "@contredanse/common": "workspace:*",
    "@contredanse/db-main": "workspace:*",
  },
}

And their counterparts in tsconfig.json

{
  "compilerOptions": {
    "baseUrl": "./src",
    "paths": {
      "@contredanse/common/*": ["../../../packages/core-lib/src/*"],
      "@contredanse/common": ["../../../packages/core-lib/src/index"],
      "@contredanse/db-main/*": ["../../../packages/db-main-prisma/src/*"],
      "@contredanse/db-main": ["../../../packages/db-main-prisma/src/index"],
    },
  },
}

API routes

Rest api

Try this route http://localhost:3000/api/rest/poem

Graphql (sdl)

In development just open http://localhost:3000/api/graphql-sdl to have the graphiql console.

Try

query {
  allPoems {
    id
    title
  }
}

Some tips

I18N & typings

Translations are handled by next-i18next. See the next-i18next.config.js. The keys autocompletion and typechecks are enabled in ./src/typings/react-i18next.d.ts.

Structure

.
├── apps
│   └── halprin-web-app
│       ├── public/
│       │   └── locales/
│       ├── src/
│       │   ├── backend/*     (backend code)
│       │   ├── components/*
│       │   ├── features/*    (regrouped by context)
│       │   └── pages/api     (api routes)
│       ├── .env
│       ├── .env.development
│       ├── (.env.local)*
│       ├── next.config.js
│       ├── next-i18next.config.js
│       ├── tsconfig.json    (local paths enabled)
│       └── tailwind.config.js
└── packages
    ├── common
    └── db-main

Develop

$ yarn dev