/Doc-Generator

Create PDFs from a variety of formats.

Primary LanguageHTMLMIT LicenseMIT

Doc Generator

Build

Try it 👀

Open in Gitpod

About 📖

An easily integrable and resusable tool built on OSS, can be easily leveraged to generate single and bulk documents in the any available formats interoperably and at same time it can upload the docs to your CDN and generate a short url for the content, you can integerate any url shortener service like bit.ly, tinyurl, etc (check our own url shortener service here). This service is developed on a plugin based model to ensure API federation across service and allow easy development of new plugins with less chances of error.

Features 🎯

  • Allow doc generation(.pdf, .docx, .png) from Google Doc templates

  • Allow bulk request processing

  • Allow easy integration for multiple CDN providers

  • Allow easy integrations for URL shortener services

  • Allow real time transforms on the raw data for complex template processing

  • Allow audit logs for tracking doc generation stages (useful in case of tracking async requests like bulk processing requests)

  • Allow image in template processing request (by url and meta)

  • Interactive UI for template validation and doc preview before generation

Requirements 📜

  1. Your machine should have Python and pip installed.

Note: Preferable Python version (3.9.7) and Ubuntu OS version(18.04)*

  1. Check the python and ubuntu version by running following commands.
python --version

lsb_release -a

PRD:

Link

Installation Steps 🚶

1. Fork it 🍴

You can get your own fork/copy of Doc-Generator by using the Fork button.

2. Clone it 👥

You need to clone (download) it to a local machine using

https://github.com/Samagra-Development/Doc-Generator.git

This makes a local copy of the repository in your machine.

Once you have cloned the Doc-Generator repository in GitHub, move to that folder first using the change directory command.

cd Doc-Generator

Move to this folder for all other commands.

3. Set it up ⬆️

Run the following commands to see that your local copy has a reference to your forked remote repository in GitHub :octocat:

git remote -v

origin https://github.com/Your_Username/Doc-Generator.git (fetch)

origin https://github.com/Your_Username/Doc-Generator.git (push)

4. Run it 🏁

  • rename env.sample file to .env and set the correct variable values

  • build and run the container docker-compose up -d

docker-compose up -d

5. API

Start the server and go to http://localhost:8000/swagger/

Sample Postman Collection here

6. Contribution 🔨

  1. Preequisites:
  • Minio (You can find how to run a minio instance on local here)

  • Teamplater Engine (You can find fork it here and run a docker-compose instance)

  1. Update the .env file and place it in the root folder with docker-coompose file

  2. Run the docker-compose file in the project root folder to run an instance of doc generator.

  3. Create a superuser docker-compose run web python manage.py createsuperuser

  4. Got to http://localhost:8000/admin and login with your credentials

  5. Create a sample GeneralConfig entry.

Note: GeneralConfig is encrypted store for storing your configurations and credentials

Sample GeneralConfig entry:

{
  "APPLICATION_SETTINGS_FILE": "gdrive_dev_settings.yaml", //needed in case of integration with google drive for docs
  "CREDENTIAL_SETTINGS_FILE": "gdrive_dev_creds.json", //needed in case of integration with google drive for docs
  "MINIO_HOST": "YOUR MINIO HOST WITH PORT", // host:port
  "MINIO_ACCESS_KEY": "", // minio/s3 username for login
  "MINIO_SECRET_KEY": "", // minio/s3 password for login
  "MINIO_BUCKET_NAME": "doc-generator", // name of the minio bucket used for storing docs
  "SHORTENER_URL": "{{yaus_host_address}}/sr/addURL" // can be any url shortener service url
}

you will need to move the .yaml and .json file downloaded on first authentication with your google drive in creds folder for non interactive authentications to google drive. check this link for reference on how to integrate with google APIs.

Note: This is a sample json config which can be fetched at runtime by the service. It can store all kinds of variables in a key value pair.

  1. Now you can import the postman API collections provided above and make sample requests to check APIs.

  2. You can find sample interfaces for creating new Plugin creation here.

You can check sample plugins here.

7. Documentation 📖

Docs can be found here