Skip to content

belgattitude/workshop-node-sql-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Workshop Node SQL Server

A boilerplate project to play with sql server from nodejs. Don't use in production, it basically allows workshop participants to try out different scenarios with sql server (prisma or kysely or tedious ?). Exercises will be provided during the session.

Getting started

Requirements: node 18+, yarn, docker. For Windows users WSL2 ubuntu is recommended.
nvm install v20  # if you don't have nodejs installed
npm i -g yarn 

Clone the repository

git clone https://github.com/belgattitude/workshop-node-sql-server.git
cd workshop-node-sql-server

Run the local database

In a new terminal:

docker compose -f ./docker/mssql/compose.yml up
# Alternatively if you want to run in detached mode
docker compose -f ./docker/mssql/compose.yml up -d --wait

Create the database

yarn workspace @workshop/db-sqlserver run db-recreate
yarn workspace @workshop/db-sqlserver run prisma-db-seed  

Tip: login: sa, password: FlowbladeSADev123

Open the database studio

yarn workspace @workshop/db-sqlserver run prisma-studio  

prisma-studio.png

tip Install a database ui tool like Jetbrains datagrip, Jetbrains westorm database plugin, dbbeaver (free), vscode extension or azure data studio (free).

Documentation

Repo structure

The monorepo is organized as follows:

.
├── apps
│   │── fastify-app
│   └── next-app       ✅ Nextjs 14+ / hono api / kysely.
├── docker
│   └── mssql          ✅ compose.yaml
└── libs
    └── db-sqlserver   ✅ Manages database creation, types and seeds

Launch Nextjs

The app we'll use during the workshop

cd apps/nextjs-app
yarn dev

Check out the Next.js app for more details.

@workshop/db-sqlserver

The package responsible for database creation / ddl / seeds and types generation.

Check out the @workshop/db-sqlserver for more details.

schema.png

License

MIT © Sébastien Vanvelthem.