This project was developed during an internship at UST Global, which is why you will see the company logo on the website.
- Create new templates after registering and logging in by navigating to "New Template" in the navbar.
- Template creation features:
- Adding headings of H1 to H6 sizes.
- Adding paragraphs.
- Adding page breaks.
- Adding tables with any number of rows and columns.
- Editing text inside any element by directly clicking on the element.
- Adding variables in any text element by enclosing them between "${" and "}" as described in the "Note" section.
- Adding new elements below pre-existing elements by clicking "Insert Below."
- Deleting any added element using the "Delete" button.
- Variables with the same name will be allocated the same value when filling the form.
- Upload templates to the database for later use.
- To use a template, go to "Browse Template" and select the desired template.
- To edit a pre-existing template, click on the "Edit" button next to the respective template.
- Note that you cannot have two documents with the same name. Edited documents will have the previous name with the "Copy" suffix.
- The backend will scan the uploaded template to create a form for all the variables.
- It will check for variables with the same name and have only one variable to populate it.
- After filling the form, click on "Submit" to download the document in the form of an HTML file.
- The text in the HTML file will still be editable for any last-minute edits.
- After opening the file, use Ctrl+P to save the document as a PDF.
The website is hosted on a free server hosting website (cyclic). Here is the link: https://ruby-excited-badger.cyclic.app/
- Go to the terminal in this folder and execute the following commands:
npm install
This command installs all the dependencies used in this project, which can be found in the package.json
file. They will be stored in a folder called node_modules
.
- Create a new file named
.env
, and add the following three variables:
ACCESS_TOKEN_SECRET=----->insert here<------
REFRESH_TOKEN_SECRET=----->insert here<------
DATABASE_URI=----->insert here<------
Generate two random strings using the following command twice:
require('crypto').randomBytes(64).toString('hex')
Then replace the placeholders ----->insert here<------
in ACCESS_TOKEN_SECRET
and REFRESH_TOKEN_SECRET
with the generated random strings. Insert your MongoDB URI to DATABASE_URI
, replacing <password>
with the actual password.
- Run the following command:
npm run dev
This command starts the server. If you see the message "Connected to MongoDB," it means the server.js is able to access the database you added.
-
Go to http://localhost:3020 to access the website. Note that it only works if you are able to access the database first.
-
To host the website globally, make the following changes:
- Change line 14 in
server.js
. - Change line 3 in
config/allowedOrigins.js
.
- Change line 14 in
Additionally, you need to configure MongoDB to allow access to the specific URL where you are hosting the website, as hosting it without proper security measures may compromise security. Depending on how you are hosting, other changes might also be required.
The project was built using the MERN stack (MongoDB, Express.js, React.js, Node.js). The following modules were used:
bcrypt
: ^5.1.0cookie-parser
: ^1.4.6cors
: ^2.8.5date-fns
: ^2.23.0dotenv
: ^10.0.0exphbs
: ^1.2.0express
: ^4.17.1express-handlebars
: ^7.0.7jsonwebtoken
: ^8.5.1mongoose
: ^7.4.0uuid
: ^8.3.2
For testing with a local database, you can use templates.json
and users.json
in the data
folder or remove these files as required.