Project Blog : Intelligent Writing Assistant

Odinaka Robert Nnamani - Nov 6 - - Dev Community

Intelligent Writing Assistant:

The intelligent writing assistant aims to help brainstorm and craft excellent writing material for personal fun, stories, or a business proposal. The use of writing is endless and can’t be overemphasized. I worked on this project alone, both the web app’s backend and frontend sides. I executed every feature in the app—the user sign-in/login experience, user authentication and document creation, and everything in between—and made sure to structure how it works.

As an engineering problem, I sourced the Gemini API in the backend program so that users can be offered a wide range of writing inputs, auto-generation, corrections, and whatever writing challenge they might want to try out

I’ve had two different ideas for this portfolio project. Each one is as ambitious as the others. Each one fails just as much as the other. This writing assistant is the third idea I’ve come up with. Honestly, at first, I was blank after the code compiler I was working on had a segmentation fault,’ and I was running out of time to debug so I could present something as a portfolio project. Then came the 2D game idea: Maze Runner. The same thing happened. I had a segmentation fault, and the worst was that even the tutorials had segmentation faults when I tried compiling them verbatim on my system. Finally, the Gemini API competition came, and I didn’t know what to do. Yes, I’ve always liked writing stories, but everything has been new to me in this coding work, so I didn’t know what to do with the API. This project sums up the feeling of never stopping and reinforces that I enjoy doing anything. Above all, I’m doing something I’ve always wanted to learn, and I can follow through structurally with the logic of the code. It’s exciting and encourages me to keep going despite bugs or errors. I made this app, and I’m proud of it. I have many life lessons to incorporate into my daily life from now on! It was nice!

structure of the writing_assistant Directory

intelligent-writing-assistant/
├── backend/
│ ├── alembic/
│ │ ├── versions/
│ │ └── env.py
│ │ └── script.py.mako
│ ├── app/
│ │ ├── init.py
│ │ ├── main.py
│ │ ├── models.py
│ │ ├── schemas.py
│ │ ├── database.py
│ │ ├── services/
│ │ │ ├── init.py
│ │ │ ├── writing_service.py
│ │ ├── routers/
│ │ │ ├── init.py
│ │ │ ├── auth.py
│ │ │ ├── writing.py
│ │ ├── utils/
│ │ ├── init.py
│ │ ├── security.py
│ ├── .env.local
│ ├── requirements.txt
│ ├── Dockerfile
│ ├── docker-compose.yml
│ └── alembic.ini
├── frontend/
│ ├── public/
│ │ ├── index.html
│ ├── src/
│ │ ├── components/
│ │ │ ├── Navbar.js
│ │ │ ├── Footer.js
│ │ │ ├── TextEditor.js
│ │ │ ├── SuggestionsList.js
│ │ ├── pages/
│ │ │ ├── Home.js
│ │ │ ├── Dashboard.js
│ │ │ ├── Editor.js
│ │ │ ├── Login.js
│ │ │ ├── Signup.js
│ │ ├── redux/
│ │ │ ├── store.js
│ │ │ ├── actions.js
│ │ │ ├── reducers.js
│ │ ├── services/
│ │ │ ├── api.js
│ │ ├── App.js
│ │ ├── index.js
│ ├── .env
│ ├── package.json
│ ├── Dockerfile
│ ├── docker-compose.yml
├── .gitignore
└── README.md

Backend (Python with FastAPI)

Frameworks and Libraries:

  • FastAPI: For building the API endpoints.
  • SQLAlchemy: For ORM (Object-Relational Mapping) with PostgreSQL.
  • Alembic: For database migrations.
  • Pydantic: For data validation.
  • JWT (PyJWT): For authentication.
  • Uvicorn: For serving the FastAPI application.
  • HTTPX: This is for making external API requests to the Gemini API.

Frontend (JavaScript with React.js)

Frameworks and Libraries:

  • React.js: For building the user interface.
  • Axios: For making HTTP requests to the backend.
  • React Router: This is used to handle navigation within the application.
  • Redux: For state management, if the application grows in complexity.
  • Formik: For form handling.
  • Yup, For form validation.
  • Quill.js: For the rich text editor component.

Features already implemented:

User authentication and authorization:
• Functionality: Registers a new user, hashes the password, and stores the user details in the database.

Login Endpoint:
• Functionality: Authenticates the user and returns a JWT token for future authenticated requests.

Document Creation and Retrieval:
• Functionality: Creates a new document with the provided title and content, associating it with the authenticated user.

  • Retrieves the document by ID if it exists and belongs to the authenticated user.

Unicorn is simple to use if you get the way it works. It happened that PostgreSQL interacts with Uvicorn to start up our app based on my file integration and structure. I haven’t used PostgreSQL before, so I went in to figure it out. It’s mainly like MySQL (looking back now). Even though I had an excellent Puhton script that integrated all parts of the code correctly, I didn’t install PostgreSQL and kept trying to start my web app. Errors and errors later, I figured it out and installed it; next was no database error, then no user error and password. It took time, but I finally configured the database, and now it connects seamlessly to the default port. Using Cors, the unicorn can share resources across PostgreSQL and ensure my web app loads up with the proper data setup.

Working on this project, I realized having some personal conviction and resolve to summon the tough stuff is essential. I struggle with concepts and understanding libraries and frameworks and what to use and when to use each. They’re all jumbled up in my head. It’s expected of a learner, but it’s frustrating not to realize simple bugs and solutions. But it’s something time will show me as I code more projects that are valuable to me.

Technically speaking, bugs are the only way you see things differently and ultimately grow, even though they can be very annoying and energy-draining for the most part. I wouldn’t do anything different except push myself to sit through the tough, unpredictable moments no matter what and keep trying to get through it all until it makes sense.

This project has reaffirmed my belief that coding, like writing, is a challenging yet profoundly satisfying endeavor. The process of meticulously structuring and refining each component of the project has been a joy. These moments remind me why I’m a tech enthusiast and why I'm committed to this path despite its challenges.

I’m a tech enthusiast, and I enjoy coding and writing as well. It’s a very specific niche that has always felt right. I know there’s a lot to come if I keep this path despite its challenges and setbacks.

Github: https://github.com/Robertpaschal/Portfolio_Project.git

LinkedIn: (31) Odinaka (Robert) Nnamani | LinkedIn

.