WriterAI is an AI-based content writing tool

Overview

WriterAI

WriterAI is an AI-based content writing tool that can turn your unstructured text into engaging content and generate up to 5 different paragraphs with an input of just 5 words! Using the power of artificial intelligence, this tool helps you write an engaging piece of content and end up with something professional. You can use it for writing emails, blogs, articles, letters, thesis and even e-books! It is completely free to use and open-source :)

This project is developed by Team 404 for Hashnode x PlanetScale hackathon. This team comprises of Ishant and Vaibhav.

Blog ✍️

To know more about how we built this project, read my article

About

WriterAI is an AI based content writing tool that helps users easily write high quality emails, blogs, letters, thesis and other stuff. One can share their project with others and work as a team.

Here is a short video on how to use WriterAI

Live Usage

You can experience the power of WriterAI from here

WriterAI Features

  • Auto Text Completion - Generates up to 120 words with an input of just 5 words
  • Inbuilt Text Editor - For writing your blogs, emails, letters, e-books and other stuff
  • Project Sharing - You can share your project with unlimited number of users and work in teams
  • Markdown Support - You can add images, tables, hyperlinks and code snippets in your projects by using markdown syntax
  • Project Download - You can download your projects in JSON, XML and Markdown formats
  • Platform Compatibility - WriterAI is highly responsive and has been tested on the latest versions of Chrome, Safari and Opera Mini
  • User Authentication - Supports Email-Password authentication and Google Mail authentication
  • User Authorization - WriterAI keeps on validating the user's auth tokens every 5 minutes automatically in order to prevent any unauthorized access

Technical details

  • The frontend of WriterAI is created using technologies like CSS, ReactJS and MaterialUI. WriterAI is highly responsive and is tested on all popular browsers like Chrome, Safari and Opera Mini. For handling the react state\s, ContextAPI is used. The frontend code is highly structured and BEM convention is followed throughout the entire CSS code.

  • The backend of WriterAI is built using the power of Ktor, Kotlin and PlanetScale! It follows MVC architecture, DRY and SOLID code principles. Currently, the backend part is deployed on Linode, which is a popular cloud service provider platform for deploying your backend and database!

Setup [Backend]

To setup the backend of WriterAI,

  1. Clone this repository and open it in Intellij IDEA IDE
  2. Create an account on PlanetScale and get the DB URL, USERNAME and PASSWORD
  3. Create an account on Linode and there, setup an ubuntu server using their docs
  4. Install java, nginx, ufw and certbot
  5. Open ports for http and https using ufw
  6. Set up NGINX by going through linode's docs. Ensure that it listens to 8080 port
  7. Enable SSL using certbot (You will be needing a domain for that)
  8. Now in Intellij IDEA, install shadowJar plugin and export the fat jar file
  9. Upload that jar file to linode using scp tool in linux from your local machine
  10. Then open your linode's terminal on your local machine using ssh
  11. Then type:
vim /etc/environment
12. Then in the file opened, type:

export DB_URL = planetscale-url
export DB_USERNAME = planetscale-username
export DB_PASSWORD = planetscale-password
export PORT = 8080
  1. Then press Ctrl+W to save and Ctrl+QA! to exit
  2. Then go back to root directory by writing cd ../../ and then in terminal, write:
source /etc/environment

This will update the environment variables

  1. Lastly, setup a firebase account and setup up Firebase ADMIN SDK by following this and paste the config json file in resource folder. Ensure that you need to use the same file for frontend part as well

  2. Finally, start the server by going to the directory where you backend jar file is and writing:

java -jar your_backend_file.jar

Server Configurations

Linode

Built With [Backend] πŸ› 

  • Linode - Linode is a popular cloud hosting service provider where you can deploy your backend
  • Ktor - Create asynchronous client and server applications using the power of Kotlin.
  • Kotlin - A modern programming language that makes developers happier.
  • PlanetScale - A MySQL-compatible serverless database platform.
  • Jetbrains Exposed - Jetbrains Exposed is an ORM framework for Kotlin.
  • Koin - Koin is a smart Kotlin dependency injection library.
  • Firebase - Uses Firebase Admin SDK for authenticating and validate user's JWT auth token.

Architecture [Backend]

The backend of WriterAI uses MVC (Model View Controller) architecture.

This is how the API flow works

Api Flow

Package Structure [Backend] πŸ“‚

Package Structure

main                            # Root Directory
.
β”œβ”€β”€ kotlin.com.writerai         # Contains all the Ktor server code
|   β”œβ”€β”€ data                    # Contains all the data handling code, which includes Database, DataSources, Repositories, Data models and Response models
|   β”œβ”€β”€ controllers             # Contains files with business logic of specified routes
β”‚   β”œβ”€β”€ di                      # Contains module which configuration of dependency inject in the project
β”‚   β”œβ”€β”€ plugins                 # Contains all the required plugins to be used by Ktor Server like authentication, logging, routes and many more
β”‚   β”œβ”€β”€ routes                  # Contains all the API routes like all routes for Projects, user and more
β”‚   └── util                    # Utility files to make work easier like extension functions and helper classes
|
└── resources                   # Contains all the configurations required to run the Ktor Server

Database Schemas

This is how the Database relationhip looks like

DB Relationship

User Schema

= varchar("username", 100) val totalApiReqMade: Column = integer("totalApiReqMade") override val id: Column> = varchar("id", 100).entityId() override val primaryKey = PrimaryKey(id) }">
object UserTable : IdTable<String>() {
    val email: Column<String> = varchar("email", 500).uniqueIndex()
    val username: Column<String> = varchar("username", 100)
    val totalApiReqMade: Column<Int> = integer("totalApiReqMade")
    override val id: Column<EntityID<String>> = varchar("id", 100).entityId()
    override val primaryKey = PrimaryKey(id)
}

Project Schema

= varchar("title", 5000) val description: Column = varchar("description", 5000) val content: Column = text("content") val coverPic:Column = varchar("coverPic", 1000) val timeStamp: Column = long("timeStamp") }">
object ProjectTable : IntIdTable() {
    val userId: Column<String> = varchar("userId", 100)
    val title: Column<String> = varchar("title", 5000)
    val description: Column<String> = varchar("description", 5000)
    val content: Column<String> = text("content")
    val coverPic:Column<String> = varchar("coverPic", 1000)
    val timeStamp: Column<Long> = long("timeStamp")
}

ShareTo Schema

= varchar("sharedTo", 100) val sharedToEmail:Column = varchar("sharedToEmail", 500) val projectId: Column = integer("projectId") }">
object ShareTable : IntIdTable() {
    val ownerId: Column<String> = varchar("ownerId", 100)
    val sharedTo: Column<String> = varchar("sharedTo", 100)
    val sharedToEmail:Column<String> = varchar("sharedToEmail", 500)
    val projectId: Column<Int> = integer("projectId")
}

Available APIs [Backend] πŸ’»

The backend of WriterAI provides many APIs to perform different operations such as insert user, getProjects, share Project, get all shared projects etc. All the available APIs and their corresponding routes can be found inside the routes folder.

Attribution

The project uses PlanetScale as its database and is made for the Hashnode X PlanetScale Hackathon.

Contact

For any queries, you can connect with me

You might also like...
A lightweight tool for managing and building Kotlin projects.

kpm kpm (Kotlin Project Manager) is a lightweight tool for managing and building Kotlin projects. What is kpm? Essentially, kpm is going to be a light

Spring boot cloud tool usage trail and learning project

Spring boot cloud tool usage trail and learning project Todo Maven based multi-p

The tool allows to dump binary API of a Kotlin library

Binary compatibility validator The tool allows to dump binary API of a Kotlin library that is public in sense of Kotlin visibilities and ensures that

A simple tool used to check the users you follow that do not follow you back.

instafbchecker - Instagram no life guide Current Release: v1.0.1 (30/08/2022) A command line tool used to check which users dont follow you back on In

Tool for exporting Old School RuneScape environments so they can be used in 3D modeling programs like Blender.

OSRS Environment Exporter Tool for exporting Old School RuneScape environments so that they can be used in 3D modeling programs like Blender. Download

Remote Administrator Tool [ RAT For Android ] No Port Forwarding
Remote Administrator Tool [ RAT For Android ] No Port Forwarding

XHUNTER RAT for Android πŸ’€ Β· Telegram Β· βš–οΈ Legal Disclaimer: For Educational Purpose Only Usage of XHUNTER for attacking targets without prior mutual

A tool to model and analyze the design of systems from .class files
A tool to model and analyze the design of systems from .class files

sift A tool to model and analyze the design of systems from java class files. Features CLI tool for building, querying and diff-ing "system models" fr

Maxibon kata for Kotlin Developers. The main goal is to practice property based testing.
Maxibon kata for Kotlin Developers. The main goal is to practice property based testing.

Kata Maxibon for Kotlin. We are here to practice property based testing. We are going to use KotlinTest to write our tests. We are going to practice p

❀️ A sample Marvel heroes application based on MVVM (ViewModel, Coroutines, LiveData, Room, Repository, Koin)  architecture.
❀️ A sample Marvel heroes application based on MVVM (ViewModel, Coroutines, LiveData, Room, Repository, Koin) architecture.

MarvelHeroes MarvelHeroes is a demo application based on modern Android application tech-stacks and MVVM architecture. Fetching data from the network

Owner
Vaibhav Jaiswal
Software Engineer Intern - Android @Pratilipi Passionate Android Developer . Competitive programmer and Ui/UX designer.
Vaibhav Jaiswal
Kotter - aims to be a relatively thin, declarative, Kotlin-idiomatic API that provides useful functionality for writing delightful console applications.

Kotter (a KOTlin TERminal library) aims to be a relatively thin, declarative, Kotlin-idiomatic API that provides useful functionality for writing delightful console applications.

Varabyte 348 Dec 21, 2022
NFC NDEF Reader and Writer. there are two separate activities for reading and writing.

kotlin-nfc-sample NFC NDEF Reader and Writer. there are two separate activities for reading and writing. Steps Clone the Project Open with Android Stu

null 2 Oct 1, 2022
πŸ’– "It's showtime!" - Loritta's Content Website

?? Showtime ?? Showtime is Loritta's content website, this project has everything that requires... Server Side Generation, to improve the website SEO.

Loritta 5 Dec 8, 2021
This Kotlin Multiplatform library is for accessing the TMDB API to get movie and TV show content. Using for Android, iOS, and JS projects.

Website | Forum | Documentation | TMDb 3 API Get movie and TV show content from TMDb in a fast and simple way. TMDb API This library gives access to T

Moviebase 37 Dec 29, 2022
Learn-kotlin - Learning more about Kotlin in various content

Kotlin study roadmap https://kotlinlang.org/docs/reference/ Getting Started Basi

Danilo Silva 0 Jan 7, 2022
Therapeutic is a platform to help easily connect patients or generally anyone struggling to get through tough times with motivating content and professional therapists.

Therapeutic Apk - https://github.com/develNerd/Therapeutic/blob/main/androidApp/release/androidApp-release6.apk Therapeutic is a Kotlin Mobile Multipl

Isaac Akakpo 1 Nov 23, 2022
YAML-based source-based kotlin module descriptors

kproject - Liberate your Kotlin projects YAML-based source-based kotlin module descriptors that runs on top of gradle. Define your kotlin multiplatfor

KorGE Game Engine & Korlibs 16 Jan 31, 2023
MangaDex V5 migration tool for Tachiyomi

Tachi Dex Migrator MangaDex V5 migration tool for Tachiyomi Download Make a backup of your backup! You have been warned… Get the app on the latest rel

Ivan Iskandar 22 Jun 11, 2022
Template for building CLI tool in Kotlin and producing native binary

Kotlin command-line native tool template This template allows you to quickly build command-line tool using Kotlin , Clikt and build a native binary fo

Ryszard Grodzicki 10 Dec 31, 2022