Backend system for CAR-dano, a Cardano blockchain-based car inspection records platform.
CAR-dano is a blockchain-based platform designed to securely store and make used car inspection reports immutable. By leveraging the Cardano blockchain, CAR-dano ensures transparency, reliability, and security in the used car market. The platform aims to reduce fraud and misinformation by providing an unalterable record of vehicle inspections, allowing buyers, sellers, and other stakeholders to access trusted reports.
This repository contains the source code for the CAR-dano backend service, built with NestJS, a progressive Node.js framework for building efficient and scalable server-side applications. This backend is responsible for handling business logic, authentication, database interactions (Prisma with PostgreSQL), integration with the Cardano blockchain (via Blockfrost API and MeshJS SDK), and providing APIs for the frontend application and external developers.
- Inspection Management: Create, read, update, and review inspection data.
- Blockchain Integration: Record report hashes and essential metadata onto the Cardano blockchain.
- Authentication & Authorization: Secure login system with user roles (Admin, Inspector, Reviewer, User).
- User Management: User account and role administration.
- Public API: Provides API endpoints for external developer access.
- File Storage: Manages uploads of inspection report PDF files and related photos.
- Framework: NestJS (Node.js)
- Language: TypeScript
- ORM: Prisma
- Database: PostgreSQL
- Blockchain Interaction:
- Blockfrost API
- MeshJS SDK (for some off-chain operations or if direct backend wallet interactions are needed)
- API Documentation: Swagger (Scalar) - accessible at
/api/v1/docswhen running locally. - Authentication: JWT, Google OAuth, Cardano Wallet (CIP-0008)
- Containerization: Docker
src/auth: Module for authentication (login, registration, JWT, guards).src/users: Module for user management.src/inspections: Core module for inspection data management.src/photos: Module for managing photos related to inspections.src/inspection-branches: Module for inspection branch management.src/blockchain: Module for Cardano blockchain interactions.src/prisma: Prisma configuration and service.src/dashboard: Module for dashboard analytics and statistics.src/public-api: Module for public API endpoints.libs: Contains shared libraries like configuration, database, etc.
-
Clone the repository:
git clone https://github.com/CAR-dano/cardano-backend.git cd cardano-backend -
Set up environment variables: Copy the
.env.examplefile to.envand fill in the required values based on the comments in.env.example.cp .env.example .env
Key variables include:
NODE_ENV,PORT,URLIPFS_API_HOST,IPFS_API_PORTDATABASE_URL(orPOSTGRES_USER,POSTGRES_PASSWORD,POSTGRES_DB)JWT_SECRET,JWT_EXPIRATION_TIMEGOOGLE_CLIENT_ID,GOOGLE_CLIENT_SECRET,GOOGLE_CALLBACK_URLCLIENT_BASE_URL,CLIENT_BASE_URL_PDFPDF_PUBLIC_BASE_URLBLOCKFROST_ENV,BLOCKFROST_API_KEY_PREVIEW,BLOCKFROST_API_KEY_PREPROD,BLOCKFROST_API_KEY_MAINNETWALLET_SECRET_KEY_TESTNET,WALLET_ADDRESS_TESTNETWALLET_SECRET_KEY_MAINNET,WALLET_ADDRESS_MAINNET
$ docker-compose up -d --build