ChatGPT-based Singapore Travel Plan Planner Chatbot - Backend

Sunse

Sunse Kwon

ChatGPT-based Singapore Travel Plan Planner Chatbot - Backend

Project Overview

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

Objectives

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.

Development Environment

Development Period

2023.07.26 ~ 2023.08.02 (Original development)
2023.08.10 ~ 2023.08.16 (Rebuild original project using Docker Container)

Deploy URL

Data Modeling

Check project repository

Feature Planning

Check project repository

Feature Details

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.

Challenges Faced

Monolithic vs. DRF:
Transitioning from a monolithic architecture to Django REST Framwork was challenging, especially managing separate frontend and backend projects.
JWT Authentication:
Implementing JWT authentication without prior understanding led to significant trial and error. Learned to properly handle Bearer tokens and implement token validation.
Deployment:
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.
Custom Domain Issues:
Faced difficulties linking a custom domain with GitHub pages, resolving the need to set up a subdomain for server communication.
Asynchronous Communication:
Explored various methods like fetch, ajax, and axios for async communication, initially struggling without a deep understanding.
Dynamic Webpages:
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.
HTTPS Implementation:
Encountered issues with applying HTTPS to custom domain URLs on GitHub pages.

Conclusion

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.
Like this project

Posted May 6, 2025

Developed a backend server for a Singapore travel plan chatbot using Django REST Framework and OpenAI API.