dhythm / ts-rest-sample

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Sample app with ts-rest

A sample app using ts-rest.

Creating the environment

Install the core package and Zod

npm install @ts-rest/core
npm install zod

npm install --save-dev typescript
tsc --init

Make sure that strict in tsconfig.json is true if you use the app with zod, otherwise you may face performance issues #162

npm init @eslint/config

✔ How would you like to use ESLint? · problems
✔ What type of modules does your project use? · esm
✔ Which framework does your project use? · react
✔ Does your project use TypeScript? · Yes
✔ Where does your code run? · browser
✔ What format do you want your config file to be in? · YAML
✔ Would you like to install them now? · Yes
✔ Which package manager do you want to use? · npm
npm install --save-dev --save-exact prettier
echo {}> .prettierrc.json
npm install --save-dev eslint-config-prettier
npm install --save-dev eslint-plugin-import eslint-plugin-unused-imports

Server implementation

npm install express
npm install cors
npm install --save-dev @types/express @types/cors
npm install @ts-rest/express
# or
npm install @ts-rest/nest
# or
npm install @ts-rest/next

Client implementation

npm install @tanstack/react-query
npm install @ts-rest/react-query
npm install react react-dom
npm install --save-dev @types/react @types/react-dom
npm install --save-dev vite @vitejs/plugin-react @types/node
touch vite.config.ts
mkdir public
touch public/index.html
touch src/client/index.tsx

Setting up the configuration

npm install --save-dev concurrently
npm install --save-dev ts-node

About


Languages

Language:TypeScript 85.3%Language:HTML 14.7%