A very simple FastAPI service that provides two main functionalities:
-
Statement Parsing: Parses M-PESA, and bank statements from PDF files and extracts transaction details. The application does not store the transaction data or the original statement PDFs. This api is used by the frontend application which visualizes the transaction data. This is the web version of the CountPesa mobile app.
-
Feedback Forwarding: Forwards user feedback to a Google Sheets, facilitating easy aggregation and analysis of user responses and critical errors in the frontend application.
- Docker and Docker Compose (recommended)
- Python 3.8 or higher (for local development)
- Access to a Google Sheets API service account (optional if feedback needed)
git clone https://github.com/DMGithinji/countpesa-server.git
cd countpesa-serverCreate a .env file in the root directory based on the provided .env.sample. Only necessary if you want to link to Google Sheets for feedback forwarding.
To build and run the application using Docker:
docker build -t app .
docker run -p 8000:8000 --env-file .env app
Alternatively, if you are using Docker Compose:
docker-compose up --build
# Create and activate virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install dependencies
pip install -r requirements.txt
# Run the application
uvicorn app.main:app --reload --host 0.0.0.0 --port 8000- The API will be available at http://localhost:8000
- Access
/docsfor the interactive Swagger UI documentation
You can test this server with the frontend application:
- Live web app: app.countpesa.com
- Source code: GitHub Repository
Contributions to the project are welcome! Here are some ways you can contribute:
We're looking to expand the service to handle bank statements with the same transaction interface.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
- Enhanced transaction categorization
- Support for additional financial institutions
- Improved error handling
- Performance optimizations
- Test coverage