Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added first draft of documentation and logos #3

Merged
merged 1 commit into from
Jul 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
[![](https://dcbadge.vercel.app/api/server/fTpqUTMmVa?style=flat)](https://discord.gg/fTpqUTMmVa) [<img src="https://img.shields.io/badge/LinkedIn-0077B5?style=for-the-badge&logo=linkedin&logoColor=white" height="20px" />](https://www.linkedin.com/in/oskardudycz/) [![Github Sponsors](https://img.shields.io/static/v1?label=Sponsor&message=%E2%9D%A4&logo=GitHub&link=https://github.com/sponsors/oskardudycz/)](https://github.com/sponsors/oskardudycz/) [![blog](https://img.shields.io/badge/blog-event--driven.io-brightgreen)](https://event-driven.io/?utm_source=event_sourcing_nodejs) [![blog](https://img.shields.io/badge/%F0%9F%9A%80-Architecture%20Weekly-important)](https://www.architecture-weekly.com/?utm_source=event_sourcing_nodejs)

![](./src/docs/public/social.png)

# Pongo

Pongo - MongoDB on Postgres with all strong consistency benefits
Expand Down Expand Up @@ -35,8 +39,8 @@ const cruella = { _id: uuid(), name: "Cruella", age: 40 };
await pongoCollection.insertOne(roger);
await pongoCollection.insertOne(cruella);

let inserted = await pongoCollection.insertOne(alice);
const anitaId = inserted.insertedId;
const { insertedId } = await pongoCollection.insertOne(alice);
const anitaId = insertedId;

// Updating
await users.updateOne({ _id: anitaId }, { $set: { age: 31 } });
Expand Down Expand Up @@ -74,8 +78,8 @@ const cruella = { _id: uuid(), name: "Cruella", age: 40 };
await pongoCollection.insertOne(roger);
await pongoCollection.insertOne(cruella);

let inserted = await pongoCollection.insertOne(alice);
const anitaId = inserted.insertedId;
const { insertedId } = await pongoCollection.insertOne(alice);
const anitaId = insertedId;

// Updating
await users.updateOne({ _id: anitaId }, { $set: { age: 31 } });
Expand Down
5 changes: 1 addition & 4 deletions src/docs/.vitepress/config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,7 @@ export default defineConfig({
sidebar: [
{
text: 'Documentation',
items: [
{ text: 'Getting Started', link: '/getting-started' },
{ text: 'API Docs', link: '/api-docs' },
],
items: [{ text: 'Getting Started', link: '/getting-started' }],
},
],

Expand Down
92 changes: 91 additions & 1 deletion src/docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,94 @@

![](/logo.png)

TODO
Pongo is a MongoDB on Postgres with all strong consistency benefits.

Install Pongo as an npm module and save it to your package.json

```bash
npm install @event-driven-io/pongo
```

## Example

You can use Pongo syntax with explicit typing about supported syntax:

```ts
import { pongoClient } from '@event-driven-io/pongo';
import { v4 as uuid } from 'uuid';

type User = { name: string; age: number };

const connectionString =
'postgresql://dbuser:secretpassword@database.server.com:3211/mydb';

const pongoClient = pongoClient(postgresConnectionString);
const pongoDb = pongoClient.db();

const users = pongoDb.collection<User>('users');
const roger = { name: 'Roger', age: 30 };
const anita = { name: 'Anita', age: 25 };
const cruella = { _id: uuid(), name: 'Cruella', age: 40 };

// Inserting
await pongoCollection.insertOne(roger);
await pongoCollection.insertOne(cruella);

let inserted = await pongoCollection.insertOne(alice);
const anitaId = inserted.insertedId;

// Updating
await users.updateOne({ _id: anitaId }, { $set: { age: 31 } });

// Deleting
await pongoCollection.deleteOne({ _id: cruella._id });

// Finding by Id
const anitaFromDb = await pongoCollection.findOne({ _id: anitaId });

// Finding more
const users = await pongoCollection.find({ age: { $lt: 40 } });
```

Or use MongoDB compliant shim:

```ts
import { MongoClient } from '@event-driven-io/pongo';
import { v4 as uuid } from 'uuid';

type User = { name: string; age: number };

const connectionString =
'postgresql://dbuser:secretpassword@database.server.com:3211/mydb';

const pongoClient = new MongoClient(postgresConnectionString);
const pongoDb = pongoClient.db();

const users = pongoDb.collection<User>('users');
const roger = { name: 'Roger', age: 30 };
const anita = { name: 'Anita', age: 25 };
const cruella = { _id: uuid(), name: 'Cruella', age: 40 };

// Inserting
await pongoCollection.insertOne(roger);
await pongoCollection.insertOne(cruella);

let inserted = await pongoCollection.insertOne(alice);
const anitaId = inserted.insertedId;

// Updating
await users.updateOne({ _id: anitaId }, { $set: { age: 31 } });

// Deleting
await pongoCollection.deleteOne({ _id: cruella._id });

// Finding by Id
const anitaFromDb = await pongoCollection.findOne({ _id: anitaId });

// Finding more
const users = await pongoCollection.find({ age: { $lt: 40 } }).toArray();
```

## Is it production ready?

What's there it's safe to use, but it's far from being 100% compliant with MongoDB.
15 changes: 6 additions & 9 deletions src/docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,24 @@ layout: home

hero:
name: 'Pongo'
text: 'Event Sourcing development made simple'
tagline: Take your event-driven applications back to the future!
text: 'Like Mongo<br/>But on Postgres<br/>And<br/>Strong Consistency'
tagline: 'Flexibility or Consistency? Why not both!'
image:
src: /logo.png
alt: Pongo logo
actions:
- theme: brand
text: Getting Started
link: /getting-started
- theme: alt
text: API Docs
link: /api-docs
- theme: alt
text: 🧑‍💻 Join Discord Server
link: https://discord.gg/fTpqUTMmVa

features:
- title: Keep your data consistent
details: Don't be afraid of getting inconsistent state
- title: DevExperience as prime goal
details: Reduce the boilerplate, and focus on delivery with accessible tooling
- title: Gain insights from your data
details: Unleash the power of your data with Event Sourcing capabilities
- title: All patterns in one place
details: Use Decider, Workflow and other event-driven best practices seamlessly
- title: Known experience, new capabilities
details: Keep your muscle memory, but get new tricks and TypeScript superpowers
---
Binary file removed src/docs/public/hexagon.png
Binary file not shown.
Binary file modified src/docs/public/logo-square.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/docs/public/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/docs/public/social.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.