Skip to content

Commit 694cc2d

Browse files
authored
Merge pull request #1 from beekeeper-studio/psql-server
Psql server
2 parents b04423f + cf6851e commit 694cc2d

35 files changed

+5435
-6717
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,5 @@ temp/
2424
# yarn.lock
2525
# pnpm-lock.yaml
2626
# or if you use specific test result files
27-
# coverage/
27+
coverage/
2828
# test-results/

CLAUDE.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# QueryLeaf Development Guide
2+
3+
## Build & Test Commands
4+
- Full build: `yarn build`
5+
- Typecheck: `yarn typecheck`
6+
- Lint: `yarn lint` (fix: `yarn lint:fix`)
7+
- Format: `yarn format` (check: `yarn format:check`)
8+
- Run all tests: `yarn test`
9+
- Run individual package tests: `yarn test:lib`, `yarn test:cli`, `yarn test:server`, `yarn test:pg-server`
10+
- Run single test: `cd packages/[package] && npx jest -t "test name"` or `npx jest path/to/test.test.ts -t "test name"`
11+
- Integration tests: `yarn test:lib:integration` (requires Docker)
12+
- Documentation: `yarn docs:serve` (dev), `yarn docs:build` (build)
13+
14+
## Code Style Guidelines
15+
- TypeScript with strict typing; avoid `any` when possible
16+
- Single quotes, trailing commas, 2-space indentation, 100 char line limit
17+
- Prefix unused variables with underscore (e.g., `_unused`)
18+
- Monorepo structure with packages: lib, cli, server, postgres-server
19+
- Descriptive variable/function names in camelCase
20+
- Error handling with proper try/catch blocks and meaningful error messages
21+
- Use async/await for asynchronous code
22+
- Follow existing patterns for similar functionality
23+
- Tests should cover both unit and integration cases

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@ QueryLeaf is a library that translates SQL queries into MongoDB commands. It par
2525
- Array element access (e.g., `items[0].name`)
2626
- GROUP BY with aggregation functions (COUNT, SUM, AVG, MIN, MAX)
2727
- JOINs between collections
28+
- Multiple interfaces:
29+
- Library for direct integration in your code
30+
- CLI for command-line SQL queries
31+
- Web Server for REST API access
32+
- **PostgreSQL Wire Protocol Server** for connecting with standard PostgreSQL clients
2833

2934
## SQL to MongoDB Translation Examples
3035

docs/index.md

Lines changed: 53 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ db.collection('users').aggregate([
157157
<div class="use-cases-section">
158158
<div class="container">
159159
<div class="section-title">
160-
<h2>Three Ways to Use QueryLeaf</h2>
160+
<h2>Four Ways to Use QueryLeaf</h2>
161161
<p>Choose the right option for your workflow</p>
162162
</div>
163163

@@ -304,6 +304,52 @@ const { results, rowCount, executionTime } = await response.json();
304304
</div>
305305
</div>
306306

307+
<!-- PostgreSQL Server Package -->
308+
<div class="package-section package-pg-server">
309+
<div class="package-content">
310+
<h3>4. PostgreSQL Wire Protocol Server</h3>
311+
<ul class="package-features">
312+
<li>Connect to MongoDB using any standard PostgreSQL client</li>
313+
<li>Use tools like pgAdmin, DBeaver, or Beekeeper Studio</li>
314+
<li>Native integration with any application supporting PostgreSQL</li>
315+
<li>No specialized drivers or adapters needed</li>
316+
<li>Transaction support (BEGIN, COMMIT, ROLLBACK)</li>
317+
</ul>
318+
<div class="package-buttons">
319+
<a href="usage/postgres-server/" class="md-button">
320+
PostgreSQL Server Documentation
321+
</a>
322+
</div>
323+
</div>
324+
<div class="package-code">
325+
```bash
326+
# Install globally
327+
npm install -g @queryleaf/postgres-server
328+
329+
# Start the PostgreSQL-compatible server
330+
queryleaf-pg-server --db mydb
331+
332+
# Connect with any PostgreSQL client:
333+
psql -h localhost -p 5432 -d mydb -U any_username
334+
```
335+
336+
```
337+
# Or use in your application code:
338+
import { MongoClient } from 'mongodb';
339+
import { PostgresServer } from '@queryleaf/postgres-server';
340+
341+
// Create and start the server
342+
const mongoClient = new MongoClient('mongodb://localhost:27017');
343+
await mongoClient.connect();
344+
345+
const pgServer = new PostgresServer(mongoClient, 'mydb', {
346+
port: 5432,
347+
host: 'localhost'
348+
});
349+
```
350+
</div>
351+
</div>
352+
307353
<div class="package-buttons-container">
308354
<a href="getting-started/installation/" class="md-button md-button--primary">
309355
Get Started with QueryLeaf
@@ -338,6 +384,11 @@ const { results, rowCount, executionTime } = await response.json();
338384
background: linear-gradient(to right, #f5f9f5, #ffffff);
339385
}
340386

387+
.package-pg-server {
388+
background: linear-gradient(to right, #ffffff, #f5f9f5);
389+
flex-direction: row-reverse;
390+
}
391+
341392
.package-content, .package-code {
342393
flex: 1;
343394
padding: 30px;
@@ -414,7 +465,7 @@ const { results, rowCount, executionTime } = await response.json();
414465
<li>Full feature set</li>
415466
<li>Commercial license</li>
416467
<li>Email support</li>
417-
<li>All packages included (Library, CLI, Server)</li>
468+
<li>All packages included (Library, CLI, Web Server, PostgreSQL Server)</li>
418469
<li>Use in proprietary applications</li>
419470
<li>No AGPL requirements</li>
420471
</ul>
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<!-- Fathom - beautiful, simple website analytics -->
2+
<script src="https://cdn.usefathom.com/script.js" data-spa="auto" data-site="SGMKGHHQ" defer></script> <!-- / Fathom -->

docs/support/license-faq.md

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
# License FAQ
2+
3+
## General Questions
4+
5+
### What license does QueryLeaf use?
6+
QueryLeaf uses a dual licensing model:
7+
- GNU Affero General Public License v3 (AGPL-3.0) for the Community Edition
8+
- Commercial License for businesses using QueryLeaf in proprietary applications
9+
10+
### What is the difference between the AGPL and Commercial Licenses?
11+
The AGPL is a strong copyleft license that requires any modifications to be shared under the same license and requires source code disclosure if you run a modified version as a service. The Commercial License removes these requirements, allowing you to use QueryLeaf in proprietary applications without disclosing your source code.
12+
13+
### Which license should I choose?
14+
- Choose the **AGPL license** if you are working on open source projects, personal projects, or for evaluation.
15+
- Choose the **Commercial License** if you are using QueryLeaf in a proprietary application, especially if you're offering it as a service or if you need commercial support.
16+
17+
## AGPL Questions
18+
19+
### Can I use the AGPL version in a commercial project?
20+
Yes, but with important caveats. If your application is offered as a service (including web applications), the AGPL requires you to make the source code of your application available to users, including any modifications you've made to QueryLeaf.
21+
22+
### Does the AGPL affect my entire application?
23+
Yes, the AGPL's copyleft provisions generally extend to the entire application that incorporates the AGPL-licensed code, not just the QueryLeaf parts.
24+
25+
### What if I'm only using QueryLeaf internally?
26+
Even internal usage may trigger AGPL requirements if users (including employees) interact with the application over a network. For purely internal tools where source code is never shared outside your organization, AGPL may be suitable, but consult with your legal team.
27+
28+
## Commercial License Questions
29+
30+
### What does the Commercial License cover?
31+
The Commercial License covers all QueryLeaf components:
32+
- Core library
33+
- Command-line interface (CLI)
34+
- Web Server
35+
- PostgreSQL Server
36+
37+
### Are there any usage limitations with the Commercial License?
38+
The Commercial License prohibits:
39+
- Using QueryLeaf to create a competing product
40+
- Redistributing QueryLeaf as a standalone product
41+
- Removing copyright notices
42+
43+
### Do I need a license for each developer or for each deployment?
44+
Our pricing is structured per developer for the Developer License. The Business License covers unlimited developers. There are no additional per-deployment or per-server fees.
45+
46+
### Do I need to purchase a separate license for the PostgreSQL Server?
47+
No, all server components (Web Server and PostgreSQL Server) are included in the same Commercial License. There's no need to purchase separate licenses for different components.
48+
49+
## Server-specific Questions
50+
51+
### Does the AGPL apply to the PostgreSQL Server and Web Server components?
52+
Yes, if you're using the AGPL version, the license requirements apply to both server components. If you run either server as a service, you must make the source code (including modifications) available to users of that service.
53+
54+
### Are there any technical limitations in the Community Edition of the servers?
55+
No, the Community Edition includes the full functionality of both server components. The difference is purely in the licensing terms, not in technical capabilities.
56+
57+
### Can I embed the PostgreSQL Server in my application?
58+
- With the **AGPL license**: Yes, but you must make your application's source code available to users.
59+
- With the **Commercial license**: Yes, with no requirement to disclose your source code.
60+
61+
## Support Questions
62+
63+
### Does the Commercial License include support?
64+
Yes, all commercial licenses include email support. Higher-tier licenses include priority support, quarterly reviews, and dedicated account managers.
65+
66+
### Is there any support for the Community Edition?
67+
Community support is available through GitHub issues. Commercial support is only available with a paid license.
68+
69+
### How do I upgrade my license?
70+
To upgrade from Developer to Business or from Business to Enterprise, contact [[email protected]](mailto:[email protected]) with your current license information.
71+
72+
## Still Have Questions?
73+
74+
If you have additional questions about licensing or need help determining which license is right for you, please contact us:
75+
76+
77+
- Subject: "License Question"

docs/support/pricing.md

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
# Pricing & Licensing
2+
3+
QueryLeaf uses a dual-licensing model designed to balance open source availability with sustainable commercial development.
4+
5+
## Licensing Options
6+
7+
QueryLeaf is available under two licensing options:
8+
9+
1. **AGPL v3 License (Community Edition)** - Free for open source projects, personal use, and evaluation
10+
2. **Commercial License** - For commercial use in proprietary applications
11+
12+
## Community Edition
13+
14+
The Community Edition of QueryLeaf is licensed under the [GNU Affero General Public License v3 (AGPL-3.0)](https://www.gnu.org/licenses/agpl-3.0.html). This license:
15+
16+
- Allows free use, modification, and distribution of the software
17+
- Requires that any modifications to the software be shared under the same license
18+
- Requires source code disclosure if you run a modified version of the software as a service over a network
19+
- Has strong copyleft provisions that may affect proprietary applications
20+
21+
The AGPL license is perfect for:
22+
- Open source projects
23+
- Personal projects
24+
- Educational purposes
25+
- Evaluation before purchase
26+
27+
## Commercial License
28+
29+
Our Commercial License is designed for businesses and organizations that require more flexibility in how they use and distribute QueryLeaf. This license:
30+
31+
- Removes the AGPL requirements for source code disclosure
32+
- Allows integration into proprietary software without license contamination
33+
- Provides commercial support options
34+
- Includes all components: Library, CLI, Web Server, and PostgreSQL Server
35+
36+
## Pricing Plans
37+
38+
### Developer License
39+
- **$49** per developer per month
40+
- Ideal for individual developers and small teams
41+
- Includes:
42+
- Full feature set
43+
- Commercial license
44+
- Email support
45+
- All packages (Library, CLI, Web Server, PostgreSQL Server)
46+
- Use in proprietary applications
47+
- No AGPL requirements
48+
49+
### Business License
50+
- Starting at **$99+** per month
51+
- Perfect for teams and growing businesses
52+
- Includes:
53+
- Everything in Developer tier
54+
- Unlimited developers
55+
- Priority email support
56+
- Quarterly reviews
57+
- Performance optimization
58+
- Extended security updates
59+
60+
### Enterprise License
61+
- **Custom pricing** based on your needs
62+
- For organizations requiring dedicated support and custom features
63+
- Includes:
64+
- Everything in Business tier
65+
- Dedicated account manager
66+
- Priority support with SLA
67+
- Custom development available
68+
- Deployment assistance
69+
- Training and onboarding
70+
71+
## Server Components and Licensing
72+
73+
Both the Web Server and PostgreSQL Server components are covered under the same dual-licensing model. This means:
74+
75+
1. **Under AGPL**: If you run either server as a service, you must make the source code (including any modifications) available to users of that service.
76+
77+
2. **Under Commercial License**: You can run and distribute the server components as part of your proprietary applications without AGPL obligations.
78+
79+
The PostgreSQL Server component is particularly valuable for commercial users as it allows seamless integration with existing PostgreSQL clients and tools, making it ideal for enterprise deployments.
80+
81+
## How to Purchase
82+
83+
For more information or to purchase a commercial license:
84+
85+
- **Developer License**: [Email [email protected]](mailto:[email protected]?subject=QueryLeaf Developer License)
86+
- **Business License**: [Email [email protected]](mailto:[email protected]?subject=QueryLeaf Business License)
87+
- **Enterprise License**: [Email [email protected]](mailto:[email protected]?subject=QueryLeaf Enterprise License)
88+
89+
## Need Help?
90+
91+
For questions about licensing or to discuss your specific needs, please [contact our sales team](mailto:[email protected]).

0 commit comments

Comments
 (0)