Skip to content

Repository files navigation

TsrestReactBoilerplate

Overview

This project is a monorepo generated using Nx. It implements a chatbot application using the ts-rest framework.

Folder structure:

Apps

  • client: the client application
  • client-e2e: the e2e tests for the client application. Generated by nx but left empty.

Services

  • server: the server implementation
  • server-e2e: the e2e tests for the server application. Generated by nx but left empty.

Libs

  • api: API contracts definition
  • api-errors: API errors shared accross the libs and services
  • completion-client: completion service definition and implementations
  • scan-client: the scanner service definition and implementations (unused)
  • storage-client: the storage service definition and implementations (unused)

Getting Started

Environment

In order to run the project, you need to set up a Clerk account and a Clerk project. You can create an account for free.

Except for the Clerk account, you don't need to set up any other environment variables, just copy/paste the .env.example file to .env.

LiteLLM

The config file for LiteLLM is located in the infra/litellm folder and is an example of how to configure LiteLLM. The models will not be downloaded automatically, you need to download them manually.

To do so, run ollama pull <model_name> in the ollama container and update the litellm config file with the model name.

Installation

  1. Clone the repository
  2. Start docker services
docker-compose up -d
  1. Install dependencies
pnpm install
  1. Run the server
pnpm dev-server
  1. Run the client
pnpm dev-front
  1. Open the client application in your browser
http://localhost:4200

Create your app from the template

Define your API contracts

Define your API contracts in the libs/api/src/presentation folder.

Add the contract your created in the libs/api/src/presentation/api.ts file.

This will automatically add it to the client in the frontend.

Implement the API logic in the server

  1. Create a controller for the manipulated objects in the services/server/src/application folder.

  2. Create a repository for the controller in the services/server/src/domain folder. Add an implementation of this repository. If this implementation is in memory, you can implement in in the same file. Otherwise, create it in the infrastructure folder.

  3. Create a router for the controller in the services/server/src/presentation/routes folder.

  4. Add the router to your app in the services/server/src/app.ts file.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages