Giter VIP home page Giter VIP logo

visualmailer's Introduction

QuickSend Logo

QuickSend

QuickSend is a visual drag and drop email builder that allows users to design, develop and send emails fast.

Key features:

  • User authentication
  • Email list management
  • Ability to upload CSV files to bulk import contacts
  • Drag and drop email builder
  • Edit emails using the command palette for keyboard shortcuts
  • Send campaigns instantly, as well as schedule for a certain day and time

Demo Video

Watch demo video

Tech Stack

This project's tech stack has been built around the T3 Stack, as well as other libraries and tools for implementing app specific features.

  • Next.js (React)
  • Typescript
  • Tailwind CSS
  • PostgreSQL
  • Prisma
  • Auth.js
  • tRPC (fully typesafe api requests)
  • Cloudinary
  • Headless UI (headless accessible components)
  • Zod (input validation)
  • dnd-kit
  • Nodemailer
  • React Hot Toast

Running locally

Next.js App: npm run dev

Prisma Studio: npx prisma studio

Documentation

Converting React components to email friendly HTML and CSS

The renderToHtml.ts utils function is responsible for converting React components to email friendly HTML and CSS. It does this by using using ReactDOMServer.renderToStaticMarkup() to render the React component to a string. This also handles converting CSS-in-JS to regular CSS.

Storing and retrieving React components from the database

The rendered html is never stored in the database and is ran adhoc when the user chooses to render their email to HTML or send a campaign. Instead, an array of objects containing the blocks of the email body as well as any global styles are stored as a stringified JSON object in the database. They are stored as objects containg a unique id, the name of the component and the props the component receives. The React component itself is never stored in the database.

Then, to retrieve the data, the data is parsed from the database using the parseAndGenerateBlocks function as well as the generateElement function which is used to convert the data into React components on the fly. Both functions can be found in src -> campaignEditor -> utils -> campaignEditorUtils.

Adding New Blocks to the Editor

  1. Create a new object in the blockattributes.ts file which defines the properties a component has.
  2. Create any new properties below in the blockInfo object, with the appropriate inputType, name and values (if applicable).
  3. Create a new component in the campaignEditor folder, using email supported HTML and CSS which receives the props defined in the blockattributes.ts file. Use conditional rendering to render the appropriate HTML and CSS based on the props.
  4. Add the component name and reference to the generateElement function in the campaignEditorUtils.ts file.
  5. Update the components state array in the [campaignId].tsx file found in src -> pages -> campaign -> edit to include the new component.

Note: Ensure componentNames and ids are consistent across all files.

Using QuickSend without an account

The example builder blocks editor is facilitated through the 'example-builder' campaignId dynamic route with state and serverside rendering. Provided the campaignId is 'example-builder' (e.g. /admin/campaign/edit/example-builder), all users (regardless of their authentication state) will be able to access the editor. For all other routes, users will need to be authenticated in order to view their campaigns and experience the full editor.

Certain features are restricted without an account, such as the ability to save and send campaigns, upload an image. Instead, users are able to render their email to HTML which can then be used to send email elsewhere.

Campaign Scheduling

Email scheduling is facilitated through a cron job that checks the database for any campaigns that have a scheduled date at/before the current time and have not yet been sent. If a campaign is found, the cron job will send the email and update the campaign's sent status to true.

The cron job file that is responsible for this can be found at src -> api -> scheduled-email-sender-cron.ts.

visualmailer's People

Contributors

jackblatch avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.