Prisere is an all-in-one platform to empower Small-Medium Sized Businesses (SMBs) during times of disaster by smoothing the business-interruption claims process.
The template repository is laid out as follows below.
.
├── README.md
├── backend
│ ├── Dockerfile # Container configuration for backend
│ ├── README.md
│ ├── bun.lock
│ ├── package.json # Backend dependencies and scripts
│ ├── requirements.txt # Python dependencies
│ ├── src
│ │ ├── database # Database utilities, factories, and seeds
│ │ ├── dayjs.config.ts # Date/time library configuration
│ │ ├── entities # TypeORM entity definitions
│ │ ├── eslint.config.ts
│ │ ├── external # Third-party integrations (Quickbooks)
│ │ ├── lambda # AWS Lambda function handlers for email sending
│ │ ├── migrations # Database migration files
│ │ ├── modules # API endpoint modules
│ │ ├── routes.ts # Route definitions and setup
│ │ ├── server.ts # Express server entry point
│ │ ├── tests # Backend test suites
│ │ ├── typeorm-config.ts
│ │ ├── types # TypeScript type definitions
│ │ └── utilities # Helper functions and utilities
│ ├── supabase
│ │ ├── MIGRATION_TUTORIAL.md # Guide for database migrations
│ │ ├── config.toml # Supabase configuration
│ │ └── signing_key.json # JWT signing key for local auth
│ ├── terraform
│ │ ├── INSTRUCTIONS.md
│ │ ├── backend.tf # Backend infrastructure definitions
│ │ ├── iam.tf # IAM roles and policies
│ │ ├── lambda.tf # Lambda function resources
│ │ ├── main.tf # Main Terraform configuration
│ │ ├── outputs.tf # Output values from Terraform
│ │ ├── s3.tf # S3 bucket configurations
│ │ ├── terraform.tfvars # Default Terraform variables
│ │ ├── terraform.tfvars.dev # Development environment variables
│ │ ├── terraform.tfvars.prod # Production environment variables
│ │ └── variables.tf # Variable declarations
│ └── tsconfig.json
├── bun.lock
├── docker-compose.yaml
├── frontend
│ ├── Dockerfile
│ ├── README.md
│ ├── actions
│ │ └── auth.ts # Authentication server actions
│ ├── api # API client layer
│ ├── app # Next.js app directory (routes)
│ ├── bun.lock
│ ├── components # Reusable React components
│ ├── components.json
│ ├── eslint.config.mjs # ESLint configuration
│ ├── icons # Custom icon components
│ ├── lib
│ │ └── utils.ts # Common utility functions
│ ├── middleware.ts # Next.js middleware (auth, etc.)
│ ├── next.config.ts # Next.js configuration
│ ├── package-lock.json
│ ├── package.json # Frontend dependencies and scripts
│ ├── postcss.config.mjs
│ ├── public # Static assets
│ ├── schema.d.ts # Generated type definitions
│ ├── tsconfig.json
│ ├── types # TypeScript type definitions
│ └── utils # Frontend utility functions
├── package-lock.json
├── package.json
├── spec.json # API specification (generated by script)
└── tsconfig.json # Root TypeScript configuration
To deploy the app using Docker Compose run one of the following commands:
MODE="dev" LOG_VOLUME_MOUNT="./backend/log" docker compose up --build --watch # in dev more
MODE="prod" LOG_VOLUME_MOUNT="./backend/log" docker compose up --build --watch # in production modeThis will mount both the frontend and backend. LOG_VOLUME_MOUNT can be changed to redirect runtime logging. Note that running the backend in dev mode requires your local Supabase to be running - see Database Management below for instructions.
If you want to run only the backend:
cd backend
bun run dev # dev mode
# OR
bun run start # prod modeIf you want to run only the frontend
cd frontend
bun run dev # dev mode
# OR
bun run start # prod modeThe backend will be available at localhost:3001 and the frontend at localhost:3000
We use Supabase as a PostgreSQL development platform to manage our databases combined with TypeORM.
To get a Supabase instance running locally, install the Supabase CLI, make sure your Docker engine is running, and run the following commands:
cd backend/
bun run supabase startSee your local Supabase studio at localhost:54323
To migrate your local DB to match the state of prod/git, run:
bun run migration:devTo run a migration on production (use this command with caution!), run:
bun run migration:prodTo revert a migration in either environment, run:
bun run migration:dev:revert
# OR
bun run migration:prod:revertTo stop your local instance of Supabase, run:
bun run supabase stopSee MIGRATION_TUTORIAL.md for more information about managing migrations with TypeORM.
We use OpenAPI documentation to generate types for the layer between the frontend and the backend for consistency. The development process should be as follows:
- Make changes to an api endpoint in the backend.
- Update the OpenAPI routes in the associated file in the
/openapimodule. - From the root directory, run
bun run gen-typesorbun run gto generate newspec.jsonandschema.d.tsfiles. - In the
typesfolder in the frontend, update imports from theschema.d.tsas necessary and use the types in the frontend.
This ensures consistent type expectations for a safe contract between the frontend and the backend.