Skip to content

Commit 2778774

Browse files
committed
docs: update ecosystem documentation
- Add IPFS integration details and examples - Add architecture diagram showing service relationships - Update integration examples with IPFS usage - Update related projects in README and CONTRIBUTING.md
1 parent e72093c commit 2778774

File tree

2 files changed

+143
-50
lines changed

2 files changed

+143
-50
lines changed

CONTRIBUTING.md

Lines changed: 74 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,87 @@
1-
# Contributing to nostr-dm-magiclink-middleware
1+
# Contributing to Nostr DM Magic Link Middleware
22

3-
We love your input! We want to make contributing to nostr-dm-magiclink-middleware as easy and transparent as possible, whether it's:
3+
First off, thank you for considering contributing to our Nostr ecosystem! This is an open-source project, and we love to receive contributions from our community.
44

5-
- Reporting a bug
6-
- Discussing the current state of the code
7-
- Submitting a fix
8-
- Proposing new features
9-
- Becoming a maintainer
5+
## Code of Conduct
106

11-
## We Develop with Github
12-
We use GitHub to host code, to track issues and feature requests, as well as accept pull requests.
7+
This project and everyone participating in it is governed by our Code of Conduct. By participating, you are expected to uphold this code.
138

14-
## We Use [Github Flow](https://guides.github.com/introduction/flow/index.html)
15-
Pull requests are the best way to propose changes to the codebase. We actively welcome your pull requests:
9+
## How Can I Contribute?
1610

17-
1. Fork the repo and create your branch from `main`.
18-
2. If you've added code that should be tested, add tests.
19-
3. If you've changed APIs, update the documentation.
20-
4. Ensure the test suite passes.
21-
5. Make sure your code lints.
22-
6. Issue that pull request!
11+
### Reporting Bugs
2312

24-
## Any contributions you make will be under the MIT Software License
25-
In short, when you submit code changes, your submissions are understood to be under the same [MIT License](http://choosealicense.com/licenses/mit/) that covers the project. Feel free to contact the maintainers if that's a concern.
13+
Before creating bug reports, please check the issue list as you might find out that you don't need to create one. When you are creating a bug report, please include as many details as possible:
2614

27-
## Report bugs using Github's [issue tracker](https://github.com/HumanjavaEnterprises/nostr-dm.magiclink-middleware/issues)
28-
We use GitHub issues to track public bugs. Report a bug by [opening a new issue](https://github.com/HumanjavaEnterprises/nostr-dm.magiclink-middleware/issues/new); it's that easy!
15+
* Use a clear and descriptive title
16+
* Describe the exact steps which reproduce the problem
17+
* Provide specific examples to demonstrate the steps
18+
* Describe the behavior you observed after following the steps
19+
* Explain which behavior you expected to see instead and why
20+
* Include any error messages or logs
2921

30-
## Write bug reports with detail, background, and sample code
22+
### Suggesting Enhancements
3123

32-
**Great Bug Reports** tend to have:
24+
If you have a suggestion for a new feature or enhancement:
3325

34-
- A quick summary and/or background
35-
- Steps to reproduce
36-
- Be specific!
37-
- Give sample code if you can.
38-
- What you expected would happen
39-
- What actually happens
40-
- Notes (possibly including why you think this might be happening, or stuff you tried that didn't work)
26+
* Use a clear and descriptive title
27+
* Provide a step-by-step description of the suggested enhancement
28+
* Provide specific examples to demonstrate the steps
29+
* Describe the current behavior and explain which behavior you expected to see instead
30+
* Explain why this enhancement would be useful
31+
32+
### Pull Requests
33+
34+
* Fill in the required template
35+
* Do not include issue numbers in the PR title
36+
* Include screenshots and animated GIFs in your pull request whenever possible
37+
* Follow the TypeScript styleguide
38+
* Include thoughtfully-worded, well-structured tests
39+
* Document new code
40+
* End all files with a newline
41+
42+
## Development Process
43+
44+
1. Fork the repo and create your branch from `main`
45+
2. Run `npm install` to install dependencies
46+
3. Make your changes
47+
4. Add tests for any new functionality
48+
5. Run `npm test` to ensure nothing is broken
49+
6. Update documentation if needed
50+
7. Submit your pull request
51+
52+
### Testing
53+
54+
We use Jest for testing. Please ensure all tests pass before submitting a PR:
55+
56+
```bash
57+
npm test
58+
```
59+
60+
For more information about testing, see our [Testing Guide](docs/testing-nostr-services.md).
61+
62+
### TypeScript
63+
64+
This project is written in TypeScript. Please ensure your code:
65+
66+
* Has proper type definitions
67+
* Doesn't use `any` unless absolutely necessary
68+
* Follows our existing patterns for generics and type safety
69+
70+
### Commit Messages
71+
72+
* Use the present tense ("Add feature" not "Added feature")
73+
* Use the imperative mood ("Move cursor to..." not "Moves cursor to...")
74+
* Limit the first line to 72 characters or less
75+
* Reference issues and pull requests liberally after the first line
76+
77+
## Related Projects
78+
79+
This middleware is part of a larger Nostr ecosystem. Consider contributing to our related projects:
80+
81+
* [nostr-auth-middleware](https://github.com/HumanjavaEnterprises/nostr-auth-middleware)
82+
* [nostr-relay-nestjs](https://github.com/HumanjavaEnterprises/nostr-relay-nestjs)
83+
* [ipfs-nostr-file-store](https://github.com/HumanjavaEnterprises/ipfs-nostr-file-store)
4184

4285
## License
43-
By contributing, you agree that your contributions will be licensed under its MIT License.
4486

45-
## References
46-
This document was adapted from the open-source contribution guidelines for [Facebook's Draft](https://github.com/facebook/draft-js/blob/a9316a723f9e918afde44dea68b5f9f39b7d9b00/CONTRIBUTING.md).
87+
By contributing, you agree that your contributions will be licensed under the MIT License.

README.md

Lines changed: 69 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,27 @@
1010

1111
A middleware for handling magic link authentication via Nostr DMs. This package provides a secure way to implement passwordless authentication using Nostr's direct messaging system.
1212

13+
## Part of the Nostr Ecosystem
14+
15+
This middleware is part of a larger ecosystem of Nostr-related services:
16+
17+
- [nostr-auth-middleware](https://github.com/HumanjavaEnterprises/nostr-auth-middleware) - Authentication middleware for Nostr
18+
- [nostr-dm-magiclink-middleware](https://github.com/HumanjavaEnterprises/nostr-dm.magiclink-middleware) - Magic link authentication via Nostr DMs (this package)
19+
- [nostr-relay-nestjs](https://github.com/HumanjavaEnterprises/nostr-relay-nestjs) - NestJS-based Nostr relay implementation
20+
- [ipfs-nostr-file-store](https://github.com/HumanjavaEnterprises/ipfs.nostr-file-store) - IPFS-based file storage for Nostr
21+
22+
These services can be used independently or together to create a full-featured Nostr application stack:
23+
24+
```mermaid
25+
graph TD
26+
A[Client Application] --> B[nostr-auth-middleware]
27+
A --> C[nostr-dm-magiclink-middleware]
28+
B --> D[nostr-relay-nestjs]
29+
C --> D
30+
A --> E[ipfs-nostr-file-store]
31+
D --> E
32+
```
33+
1334
## Features
1435

1536
- 🔐 Secure magic link generation and verification
@@ -18,6 +39,8 @@ A middleware for handling magic link authentication via Nostr DMs. This package
1839
- 🚀 Easy integration with Express.js
1940
- 📦 TypeScript support
2041
- ⚡ Async/await API
42+
- 🤝 Works seamlessly with other Nostr services
43+
- 📁 Compatible with IPFS file storage
2144

2245
## Installation
2346

@@ -64,6 +87,43 @@ process.on('SIGTERM', async () => {
6487
});
6588
```
6689

90+
## Integration Examples
91+
92+
### With nostr-auth-middleware
93+
94+
```typescript
95+
import { createNostrAuth } from 'nostr-auth-middleware';
96+
import { createNostrMagicLink } from 'nostr-dm-magiclink-middleware';
97+
98+
const auth = createNostrAuth({ /* config */ });
99+
const magicLink = createNostrMagicLink({ /* config */ });
100+
101+
app.use('/auth', auth.router);
102+
app.use('/magic-link', magicLink.router);
103+
```
104+
105+
### With Custom Relay and IPFS
106+
107+
```typescript
108+
import { createNostrMagicLink } from 'nostr-dm-magiclink-middleware';
109+
import { createIpfsNostrStore } from 'ipfs-nostr-file-store';
110+
111+
const magicLink = createNostrMagicLink({
112+
privateKey: process.env.NOSTR_PRIVATE_KEY!,
113+
baseUrl: 'https://your-app.com/auth',
114+
relayUrl: 'wss://your-relay.com', // Your nostr-relay-nestjs instance
115+
});
116+
117+
const ipfsStore = createIpfsNostrStore({
118+
ipfsNode: 'https://your-ipfs-node.com',
119+
relayUrl: 'wss://your-relay.com',
120+
});
121+
122+
// Now you can use both services together
123+
app.use('/auth', magicLink.router);
124+
app.use('/files', ipfsStore.router);
125+
```
126+
67127
## How It Works
68128

69129
1. User requests login with their Nostr public key (npub)
@@ -80,32 +140,24 @@ process.on('SIGTERM', async () => {
80140
- ✅ Session-based verification
81141
- ✅ Automatic cleanup of expired sessions
82142

83-
## Advanced Usage
84-
85-
You can also use the services directly for more custom implementations:
86-
87-
```typescript
88-
import { NostrService, MagicLinkService } from 'nostr-dm-magiclink-middleware';
89-
90-
// Use NostrService directly for DM functionality
91-
const nostr = new NostrService(privateKey, relayUrl);
92-
93-
// Use MagicLinkService for custom magic link handling
94-
const magicLink = new MagicLinkService(privateKey, baseUrl, relayUrl);
95-
```
96-
97143
## Documentation
98144

99145
For detailed documentation, check out:
100146

101-
- [Testing Nostr Services](docs/testing-nostr-services.md) - Learn about testing strategies, common challenges, and best practices for testing Nostr services
147+
- [Testing Nostr Services](docs/testing-nostr-services.md) - Learn about testing strategies, common challenges, and best practices
102148
- [API Reference](docs/api-reference.md) - Detailed API documentation
103149
- [Security Guide](docs/security-guide.md) - Security best practices and considerations
104150

105151
## Contributing
106152

107-
Contributions are welcome! Please feel free to submit a Pull Request.
153+
Contributions are welcome! Please feel free to submit a Pull Request. Check out our [Contributing Guide](CONTRIBUTING.md) for more details.
154+
155+
## Related Projects
156+
157+
- [nostr-auth-middleware](https://github.com/HumanjavaEnterprises/nostr-auth-middleware)
158+
- [nostr-relay-nestjs](https://github.com/HumanjavaEnterprises/nostr-relay-nestjs)
159+
- [ipfs-nostr-file-store](https://github.com/HumanjavaEnterprises/ipfs.nostr-file-store)
108160

109161
## License
110162

111-
MIT License - see LICENSE file for details
163+
MIT

0 commit comments

Comments
 (0)