CurrencyApp is a comprehensive backend application for managing users, currency accounts, transactions, and currency conversions. Built with Django Rest Framework, the app supports secure user management and real-time currency exchange using external APIs.
- User Registration and Authentication: Secure user registration and login functionality.
- Currency Account Management:
- Default PLN account creation upon registration.
- Create, edit, and delete additional currency accounts.
- Protection against deletion of default PLN accounts or accounts with non-zero balances.
- Currency Conversion:
- Real-time exchange rates fetched from the NBP API.
- Support for multiple currencies (e.g., USD, EUR, GBP).
- Automatic updates for account balances during conversions.
- Transaction and History Tracking:
- Detailed logs of all transactions and account activities (deposits, withdrawals).
- Filter transactions by user and date.
- Deposits:
- Deposit money into specific currency accounts.
- Maintain a history of deposits for better financial tracking.
- Backend: Django, Django Rest Framework
- Database: SQLite (default), with support for other databases via Django settings
- Real-Time API: Integration with NBP API for live currency exchange rates
- Python 3.11
- pip
-
Clone the repository:
git clone https://github.com/gasimovv21/currencyApp.git
-
Install Expo into the frontend file by saving own project files:
cd currencyApp/currencyApp/frontend mkdir ../temp-frontend move * ../temp-frontend/ cd .. npx create-expo-app@latest frontend --template blank xcopy temp-frontend\* frontend\ /E /Y cd frontend npm install Remove-Item -Recurse -Force ../temp-frontend
-
Install backend dependencies:
cd .. pip install -r requirements.txt -
Set up and activate a virtual environment:
cd .. python -m venv venv
- Go to an IDE, open project folder and on terminal (bash) activate:
source venv/Scripts/Activate # Windows source venv/bin/activate # Linux/Mac
- Run migrations:
python manage.py makemigrations python manage.py migrate
- (In the case of error: try it on new bash terminal)
- Set up the frontend:
- Check your IPv4 address to set baseURL for running the server on your local network.
ipconfig
- Look for your "Wireless LAN adapter Wi-Fi" section, and note your IPv4 address (e.g., 192.168.x.x).
- Open the App.js file and insert your IPv4 address at the specified location on line 17.
- Start the Django development server and the Expo:
- Start API server using your IPv4 address:
python manage.py runserver <your_IPv4_here>:8000
- Start Expo Inside frontend:
npx expo start
- Access the API: Open http://<your_IPv4_here>:8000/api/ in your browser or Postman.
- Installed Docker
- Installed Docker Compose
- Clone the repository:
git clone https://github.com/gasimovv21/currencyApp cd currencyApp - Build and run the Docker containers::
- Find file below and uncomment "psycopg2-binary".
./currencyApp/currencyApp/requirements.txt
- Find file below and comment DATABASES commented for Docker and Comment default DATABASES.
./currencyApp/currencyApp/currencyApp/settings.py
- Now ready to compose up.
docker-compose up --build
-
Run migrations in Docker console:
python manage.py migrate
-
Create superuser for django administrations:
python manage.py createsuperuser
-
Access the API: The backend will be available at::
http://localhost:8000 Test endpoints by navigating to: http://localhost:8000/api/
-
Stop the Docker containers: To stop and remove containers, networks, and volumes created by docker-compose, run::
docker-compose down --volumes
- Register a new user using the
/api/register/endpoint. - Log in to manage your accounts and transactions securely.
- Each user starts with a PLN account by default.
- Create additional accounts for supported currencies like USD, EUR, and GBP.
- Manage account balances, view transaction histories, and handle deposits.
- Convert currencies using real-time exchange rates fetched from the NBP API.
- Ensure sufficient funds are available in the source account.
- Deposit money into any of your accounts.
- Track all deposits using the deposit history endpoints.
| Method | Endpoint | Description |
|---|---|---|
| POST | /api/register/ |
Register a new user |
| POST | /api/login/ |
Login a user |
| POST | /api/logout/ |
Logout a user |
| GET | /api/users/ |
List all users |
| GET | /api/users/<id>/ |
Get user details |
| PUT | /api/users/<id>/ |
Update user details |
| DELETE | /api/users/<id>/ |
Delete a user |
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/currency-accounts/ |
List all currency accounts |
| GET | /api/currency-accounts/<id>/ |
Get details of a specific account |
| POST | /api/currency-accounts/ |
Create a new currency account |
| PUT | /api/currency-accounts/<id>/ |
Update a currency account |
| DELETE | /api/currency-accounts/<id>/ |
Delete a currency account |
| GET | /api/currency-accounts/user/<id>/ |
Get accounts for a specific user |
| Method | Endpoint | Description |
|---|---|---|
| POST | /api/currency-accounts/convert/<id>/ |
Convert between currencies |
| GET | /api/currency-accounts/convert/<id>/ |
View transaction history for a user |
| Method | Endpoint | Description |
|---|---|---|
| POST | /api/currency-accounts/deposit/<id>/ |
Deposit money into a currency account |
| GET | /api/currency-accounts/deposit/<id>/ |
View deposit history for a user |
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/currency-accounts/history/<id>/ |
View account history for a user |
- Default Currency Account: Each user automatically gets a PLN account upon registration.
- Real-time Exchange Rates: The app fetches live exchange rates using the NBP API.
- Password Security: All user passwords are securely hashed using Djangoβs built-in utilities.
- Add JWT authentication for more robust session handling.
- Build a frontend app using React or Vue.js.
- Implement automated testing for all endpoints.
This project is licensed under the MIT License. See the LICENSE file for more details.
- Ahmet Eren Artam - 41155 | Recep Enes Karatekin - 40796 | Eltun Gasimov - 41160


