• Stars
    star
    103
  • Rank 333,046 (Top 7 %)
  • Language
    TypeScript
  • License
    MIT License
  • Created over 8 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

✍️ Markdown writing application that's down right, neat.

Downwrite

Node CI E2E Testing

About 🤔🦄🎉

A place to write. ✍️

So the idea here was simple build a simple markdown writing application. Markdown is a huge deal and all the cool tools kept getting shut down and naively,I thought, how hard can this really be? 🤔📝📦

So I've had poorly designed iterations of this thing for every year, on the year as one of these services got shut down. When Canvas shut down this last year, I started to get a little more serious about this idea. 💡 🔭

During planning out some of my quarterly goals at my last job I decided to go a little more full-stack with Node and start to really work through the process of building a microservice. Since I'm never really one to learning languages and frameworks in the abstract, I decided to take up Downwrite as an excuse to build those microservices. 📡💸🌎

Why Markdown 🧐🤨📋

Markdown is probably the most efficient and universal tool for conveying syntax, semantics and structure across platforms. ⬇️

Originally coined by John Gruber (Daring Fireball) it was originally conceived as a text to HTML and is the staple of static site generators, OSS as well as a fair amount of comment sections, notetaking applications or any documentation tool. 🛠

These shortcuts are almost as ubiquitous as cmd + b for bold or cmd + i for italics. ⌨️

Bottomline: markdown is data. It is a method for describing semantics of data and is data itself.

Features 🔥🚀

This is meant to be a simple writing application with some key features:

  • Write wherever you are in markdown
  • Share what you've written if you want
  • Upload a markdown file from your machine
  • Export to a static markdown file for your blog, etc.

Setup 📲⚙️

This project uses Node (v12.18.x), TypeScript and pnpm.

brew cask install pnpm
pnpm install

Personally use fnm to manage my node versions.

fnm install
fnm use

Environment

To get started create an .env file in the root of your project with the following

SECRET_KEY="SECRET SECRETS ARE NO FUN"
CURRENT_DB_ADDRESS="127.0.0.1:27017/downwrite"

Client ⚡️🦊

Logos for Related Projects

Setup

Run in your terminal from the root of the project.

pnpm dev

Open http://localhost:3000 in your browser.

UI 📝

This is the client-side of the application, it uses Next.js and is a pretty stock implementation of how Next handles routing to different views. 👨‍💻🤜🦑🤯

Downwrite needs to server side rendered to make sharing an entry as easy as possible. Next.js' data-fetching API makes it the perfect candidate. So when the page calls getServerSideProps() it fetches the data directly from the database (DB creditentials aren't exposed to the client build at all because of the bundling features inside Next 😁) and for the initial render it has data available instead of a skeleton screen. 🤖☠️💀

For the Editor this project uses Draft.js and Draft.js Plugins. Markdown syntax is used inline and autogenerates the related rich text _hello_ becomes "hello" as you type.💻⌨️🔏

For styles I just used the built-in CSS support in Next.js

Serverless Functions 🌎

To update the data, this project calls endpoints at /api/.... to enable this we're using Next'js API Routes. These are serverless functions so we don't need to keep a server or database connectioin running all the time, with serverless functions you're essentially calling the API on-demand.

This project also depends on MongoDB 🍍 for data persistence, you should see this gist on how to setup MongoDB on your machine.

To authenticate we're using JWT to call the basic CRUD functions. Basically this is using a stateless auth model, more about that here. 🔐

Related Documentation 📚

Integration Testing 🌈🦁🐛

Logos for Related Projects

pnpm test

Info 📝🧪

Short hand: page is just a representation of whatever the headless browser, Puppeteer has rendered at that given moment.

Using Puppeteer I write assertions like this:

describe("Feature", () => {
	it("does this thing", async () => {
		await page.waitForSelector("#selector");
		await page.click("#selector");
		await page.waitForSelector("#other-selector");
	});
});

This approach accomplishes two things:

  • Ensures if an await statement errors or catch() the block will cause a failure
  • Makes the test sequential and simpler to write

Related Documentation 📚

Workflow 👷‍♀️🚧

Working on this project it uses GitHub actions to run the tests and deploys using vercel for easy rollback and immutable deployments.

License ⚖️💣🛡⚔️

MIT License

Copyright (c) 2022 Charlie Peters

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

More Repositories

1

react-gluejar

Paste images from your clipboard, declaratively
TypeScript
62
star
2

obsidian

💎 A Modular CSS Library
CSS
25
star
3

type-findings

A curated list of posts about web typography
19
star
4

lgbtq.css

🌈 adding some pride to your stylesheets
CSS
17
star
5

esm-ts-starter

ES Module Boilerplate
TypeScript
11
star
6

inspire-cli

🙌 Inspiration quotes in your terminal
JavaScript
9
star
7

VVWIP

🚧 Declares the human status of your project
7
star
8

cyclops

TypeScript
7
star
9

dotfiles

🛠 Configuration for vim / neovim, git, tmux, zsh, etc.
Shell
5
star
10

thunder

⚡ Use WebP and gracefully degrade to using JPEG, GIF, or PNG
JavaScript
5
star
11

justafewicons

🎉 just a few SVG icons with some styling and flexibility
JavaScript
5
star
12

resetatron.scss

Sass Typographic Reset
CSS
4
star
13

ganymede

🌒 A color scheme that makes me think of Jupiter
Vim Script
4
star
14

knxwledge

A place to work through common algorithm problems and define basic data structures in TS 👩‍💻📋🧮
TypeScript
3
star
15

basic-react-todo-list

Basic example of a to-do list with React and TypeScript
TypeScript
3
star
16

fibonacci-deck

🃏 Sprint Planning App
TypeScript
2
star
17

observatory

Observable Library
TypeScript
2
star
18

arsenal.scss

👊 a collection of modules ready for use
CSS
2
star
19

data-sources-next-apollo

example of using apollo datasources fails to load with `schema-link`
JavaScript
2
star
20

async-file-reader

awaitable FileReader 📖🔍✋
TypeScript
2
star
21

xpw

Color palette helper
TypeScript
1
star
22

mixins.css

handy css mixins in the `@apply` format
CSS
1
star
23

stylelint-config-wilco

Ruleset for Wilco
JavaScript
1
star
24

mf

A nicer touch utility 🌈 👍
JavaScript
1
star
25

embark.scss

base styles, utilities, colors, variables and reset in sass
CSS
1
star
26

pluton.css

CSS
1
star
27

hyperganymede

🌘 Hyper.app port of Ganymede
JavaScript
1
star
28

react-branches

🔛Internal Routing Wizard for React
TypeScript
1
star
29

sanitize-object

TypeScript
1
star
30

draft-as-markdown

JavaScript
1
star
31

redribbble

🏀 Small Dribbble client built in React.js
JavaScript
1
star
32

level.css

📏Sane CSS reset
CSS
1
star
33

immutable-array-helpers

TypeScript
1
star
34

kndlng

🔥 Style utilities for JS
JavaScript
1
star
35

mercury-styleguide

🚀 Early Styleguide for Mercury Project
HTML
1
star
36

wilco

📐Opinionated Linting for CSS
JavaScript
1
star
37

ballista

WIP CLI tool
JavaScript
1
star
38

formally

Text casing app
TypeScript
1
star