Skip to content

xpertforextradeinc/CediPay

Repository files navigation

CediPay

A crypto-to-fiat app for the Ghanaian market, allowing users to sell crypto for Cedis.

πŸš€ Tech Stack

  • Backend: TypeScript, Node.js, Express
  • Database: PostgreSQL with Prisma ORM
  • Authentication: JWT with bcrypt password hashing
  • Containerization: Docker & Docker Compose
  • Testing: Jest with TypeScript support
  • Code Quality: ESLint, Prettier
  • CI/CD: GitHub Actions

πŸ“‹ Prerequisites

  • Node.js 20.x or higher
  • PostgreSQL 15 (or use Docker)
  • npm or yarn

πŸ› οΈ Local Development Setup

1. Clone the Repository

git clone https://github.com/xpertforextradeinc/CediPay.git
cd CediPay

2. Install Dependencies

npm install

3. Environment Configuration

cp .env.example .env

Edit the .env file with your configuration:

DATABASE_URL="postgresql://postgres:password@localhost:5432/cedipay_dev?schema=public"
JWT_SECRET="your-super-secret-jwt-key-change-this-in-production"
PORT=4000
NODE_ENV="development"

4. Database Setup

Make sure PostgreSQL is running, then:

# Generate Prisma client
npm run prisma:generate

# Run database migrations
npm run prisma:migrate

5. Start Development Server

npm run dev

The API will be available at http://localhost:4000

API Endpoints

  • GET /health - Health check
  • POST /api/auth/register - User registration
  • POST /api/auth/login - User login
  • GET /api/auth/profile - Get user profile (protected)

🐳 Docker Setup

Using Docker Compose (Recommended)

# Start all services (app + PostgreSQL)
docker-compose up -d

# View logs
docker-compose logs -f

# Stop services
docker-compose down

This will:

  • Start PostgreSQL on port 5432
  • Start the CediPay API on port 4000
  • Automatically run database migrations
  • Set up persistent volumes for database data

Building Docker Image Only

# Build the image
docker build -t cedipay-backend .

# Run with external database
docker run -p 4000:4000 -e DATABASE_URL="your-db-url" cedipay-backend

πŸ§ͺ Testing

# Run all tests
npm test

# Run tests in watch mode
npm run test:watch

# Run with coverage
npm test -- --coverage

πŸ“ Available Scripts

  • npm run dev - Start development server with hot reload
  • npm run build - Build production bundle
  • npm start - Start production server
  • npm run lint - Run ESLint
  • npm run format - Format code with Prettier
  • npm run typecheck - Run TypeScript type checking
  • npm run prisma:generate - Generate Prisma client
  • npm run prisma:migrate - Run database migrations
  • npm test - Run tests

πŸ—οΈ Project Structure

src/
β”œβ”€β”€ controllers/     # Route controllers
β”œβ”€β”€ middleware/      # Express middleware
β”œβ”€β”€ prisma/          # Database client
β”œβ”€β”€ routes/          # API routes
β”œβ”€β”€ types/           # TypeScript type definitions
β”œβ”€β”€ __tests__/       # Test files
β”œβ”€β”€ app.ts          # Express app configuration
└── server.ts       # Server entry point

prisma/
└── schema.prisma   # Database schema

.github/
└── workflows/      # CI/CD workflows

πŸ” Authentication

The API uses JWT (JSON Web Tokens) for authentication:

  1. Register: POST /api/auth/register with email, password, firstName, lastName
  2. Login: POST /api/auth/login with email and password
  3. Protected Routes: Include Authorization: Bearer <token> header

🚧 Development Roadmap

Current Phase: MVP Backend βœ…

  • TypeScript Node.js + Express setup
  • PostgreSQL with Prisma ORM
  • JWT Authentication
  • Docker support
  • CI/CD pipeline
  • Basic testing infrastructure

Next Phase: Payment Integration πŸ”„

  • Flutterwave payment gateway integration
  • Transaction management
  • Crypto price feeds
  • Rate calculations

Future Phases πŸ“‹

  • Frontend application (React/Flutter)
  • Real-time notifications
  • Advanced security features
  • Mobile app development

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feat/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feat/amazing-feature)
  5. Open a Pull Request

πŸ”Œ Bubble Plugin Integration

CediPay modules can be integrated with Bubble.io for no-code/low-code development. We provide comprehensive guides for:

  • GitHub Sync: Link your Bubble plugins to GitHub for version control and collaboration
  • Plugin Development: Best practices for developing CediPay-branded Bubble plugins
  • CI/CD Integration: Automated testing and deployment workflows

πŸ“– View the complete Bubble GitHub Integration Guide for step-by-step instructions on:

  • Registering as a Bubble plugin developer
  • Connecting GitHub to your Bubble account
  • Syncing plugins between Bubble and GitHub
  • Managing versioning and collaboration
  • Troubleshooting common issues

This enables easier plugin code management, versioning, collaboration, and CI/CD for CediPay modules in the Bubble ecosystem.

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ“ž Support

For questions and support, please contact the development team or create an issue in the repository.

About

A crypto-to-fiat app for the Ghanaian market, allowing users to sell crypto for Cedis.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •