A decentralized application (dApp) designed to optimize customs clearance at the Brazil using blockchain technology and zero-knowledge proofs to verify cargo documentation without exposing sensitive data.
zkCargoPass addresses the critical inefficiencies in port logistics where cargo remains stationary in containers for extended periods, leading to additional costs for individuals and businesses due to port space rental fees. Our solution employs a secure, private, and efficient approach using cutting-edge cryptographic technologies.
Currently, cargo clearance processes suffer from:
- Long waiting times for document verification
- High storage costs at port facilities
- Security risks with sensitive data exposure
- Manual processes prone to errors and delays
- Lack of transparency in the clearance pipeline
zkCargoPass solves these issues by providing instant, private document verification while maintaining regulatory compliance.
- Framework: NestJS (Node.js)
- Database: PostgreSQL with Prisma ORM
- Session Management: Redis
- Authentication: JWT with Passport.js
- ZK Proofs: Noir language with Aztec's BB.js
- API Documentation: Swagger/OpenAPI
- Framework: Next.js 14+ (React)
- UI Library: Radix UI with Tailwind CSS
- State Management: React Hooks
- Web3 Integration: Polkadot extension support
- Type Safety: TypeScript
- Package Manager: pnpm
- Language: Noir
- Circuit Types:
- Cargo validation
- Date validation
- Tax validation
- Proof System: Ultra PLONK
- Containerization: Docker & Docker Compose
- Database: PostgreSQL 14
- Cache: Redis Alpine
- Reverse Proxy: Nginx (production)
zkCargoPass/
βββ backend/ # NestJS API server
β βββ circuits/ # ZK circuits (Noir)
β βββ src/
β β βββ controllers/ # API endpoints
β β βββ services/ # Business logic
β β βββ entities/ # Database models
β β βββ middlewares/ # Custom middleware
β βββ prisma/ # Database schema & migrations
βββ frontend/ # Next.js web application
β βββ app/ # Next.js 13+ app directory
β βββ components/ # Reusable UI components
β βββ circuits/ # Client-side ZK circuits
β βββ lib/ # Utility functions
βββ docker-compose.yml # Development environment
- Node.js >= 22.0.0
- Docker and Docker Compose
- pnpm (for frontend)
- Noir toolchain (for ZK circuits)
-
Clone the repository
git clone https://github.com/maiconloure/zkCargoPass.git cd zkCargoPass -
Start infrastructure services
docker-compose up -d postgres redis
-
Setup Backend
cd backend npm install # Setup database npm run prisma:migrate npm run prisma:seed # Start development server npm run dev
-
Setup Frontend
cd frontend pnpm install # Start development server pnpm dev
-
Compile ZK Circuits (Optional)
# Install Noir if not already installed curl -L https://raw.githubusercontent.com/noir-lang/noirup/main/install | bash # Compile circuits cd backend/circuits/cargo_validation nargo compile cd ../date_validation nargo compile cd ../tax_validation nargo compile
- Frontend: http://localhost:3000
- Backend API: http://localhost:3001
- API Documentation: http://localhost:3001/api/docs
- Database: localhost:5432 (postgres/postgres)
- Redis: localhost:6379
The application implements three main ZK circuits:
Validates cargo information without revealing:
- Exact cargo values
- Detailed descriptions
- Proprietary shipping data
Proves temporal constraints like:
- Document submission deadlines
- Clearance timeframes
- Compliance windows
Verifies tax calculations while keeping private:
- Exact tax amounts
- Financial details
- Commercial agreements
The application uses PostgreSQL with the following main entities:
- Users: Customs officers, importers, and system administrators
- Documents: Import declarations and related paperwork
- Sessions: User authentication and authorization
- Audit Logs: Verification history and compliance records
Backend:
npm run dev # Start development server
npm run build # Build for production
npm run test # Run tests
npm run prisma:studio # Database GUIFrontend:
pnpm dev # Start development server
pnpm build # Build for production
pnpm start # Start production server
pnpm lint # Run linterCreate .env files in both backend and frontend directories:
Backend (.env):
DATABASE_URL="postgresql://postgres:postgres@localhost:5432/zk_cargo_pass"
REDIS_URL="redis://localhost:6379"
JWT_SECRET="your-jwt-secret"Frontend (.env.local):
NEXT_PUBLIC_API_URL="http://localhost:3001"-
Build all services
docker-compose -f docker-compose.prod.yml build
-
Deploy with environment-specific configurations
docker-compose -f docker-compose.prod.yml up -d
-
Run database migrations
docker-compose exec backend npm run prisma:migrate
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Diego Bastos - Business
- Maicon LourenΓ§o - Development
- Port of Santos for logistics insights
- Aztec for Zero-Knowledge infrastructure
- The Noir community for cryptographic primitives
zkCargoPass - Revolutionizing cargo clearance through privacy-preserving technology π