3

I am trying to make a system where a user can view/download his statements (say salary slips). The user will have ability to download PDF versions of these statements and can also save them to Google Drive.

I had some questions regarding Authentication and the Architecture of the application.

These are the components of my system -

  1. A React/Redux app (with SSR (either via express + renderToString() or frameworks like NextJS) because the generated HTML can be used to make PDFs (3rd point)) for a website served by a Django Rest APIs.

  2. A React Native app that uses the same Django Backend. The idea behind React Native isn't code reuse in Web and App but apps for both iOS and Android.

  3. For PDF generation thinking of using WeasyPrint as a python library. For the page/receipt that has to be a PDF, there will be a React Component with Styled Components library and @media print in CSS which will have print specific css like

@page {
  margin: 3cm;
  @bottom-left {
    color: #1ee494;
    font-family: Pacifico;
    content: 'Chapter 1';
  }
}

Here is a rough architecture diagram of the system and couple of flows -

Architecture of PDF generation


Questions:

Architecture
  1. Has this become very micro-servicy? Can/Should I combine the React app inside the Django app itself via some webpack magic?
  2. Should the PDF generation part be separate or can that too be accomodated in the Django app?
Authentication
  1. Users can either authenticate themselves with username-password or login via Google.
  2. Should the website and App authencation be different? Should I go with Cookie based or Token based authentication (for username/email-password combination).
  3. If I use Cookie, I know that I might face issues while using the same cookie across domains like https://api.myapp.com and https://pdf.myapp.com
  4. Login via Google might need something different altogether.
Setup
  1. Docker Compose for development but Kubernetes for production
Saving to Google Drive
  1. How do we go about doing the OAuth2 thing here so that PDFs are saved in correct Google Drive folder.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.