This project focuses on creating a backend server for a chatbot that automatically generates travel plans for Singapore using ChatGPT. The project involves setting up communication between the OpenAI Chat Completions API and a Django REST Framework (DRF) server, as well as facilitating communication between the backend and a frontend page. The backend server was deployed using AWS EC2, PostgreSQL, Gunicorn, and Nginx, Docker.
Implement a backend server that communicates with OpenAI Chat Completions and the frontend. Deploy the backend server using AWS EC2, PostgreSQL, Gunicorn, and Nginx, Docker.
- 2023.07.26 ~ 2023.08.02 (Original development)
- 2023.08.10 ~ 2023.08.16 (Rebuild original project using Docker Container)
- Initially designed the ERD model using text-davinci-003 API, integrating user input and GPT responses.
- Adjusted the ERD model when switching to ChatCompletion API with gpt-3.5-turbo, leading to modifications in the view and model to match the new API format.
- Initially planned to use JWT for authentication but lacked detailed understanding, which posed challenges in implementing the required features.
- Implemented an API in the chatbot app to communicate with the ChatGPT API and the frontend.
- Developed a user app with signup API and login/token refresh API using Simple JWT.
- Implemented JWT validation API in view.py to dynamically show/hide logout buttons based on user login status.
- Transitioning from a monolithic architecture to Django REST Framwork was challenging, especially managing separate frontend and backend projects.
- Implementing JWT authentication without prior understanding led to significant trial and error. Learned to properly handle Bearer tokens and implement token validation.
- Initially deployed the server using Uwsgi and Nginx on AWS but recognized the need to learn Docker for modern deployment practices. Later, deployed using Docker. During this phase, learned about containerization, building Docker images, Linux types (Ubuntu, Alpine), and Docker Compose YAML files.
- Faced difficulties linking a custom domain with GitHub pages, resolving the need to set up a subdomain for server communication.
- Explored various methods like fetch, ajax, and axios for async communication, initially struggling without a deep understanding.
- Learned that Django template language isn’t suitable for dynamic web pages, leading to the implementation of token-based conditional rendering for login/logout buttons.
- Encountered issues with applying HTTPS to custom domain URLs on GitHub pages.
This DRF project significantly enhanced my understanding of APIs and backend development while highlighting areas for improvement. Successfully connecting frontend and backend projects and deploying a functional web service was a valuable learning experience, exposing me to real-world challenges and modern development practices. By presenting these detailed aspects of the project, I aim to demonstrate my capability to handle complex backend development tasks and my commitment to continuous learning and improvement in the field of data engineering.

