@b3dotfun/b3-api
v0.0.99
Published
Main B3 API
Maintainers
Keywords
Readme
b3-api
Main B3 API
About
This project uses Feathers. An open source framework for building APIs and real-time applications.
Getting Started
Install your dependencies
cd path/to/b3-api npm installStart your app
npm run build # Compile TypeScript source npm start
Testing
Run npm test and all your tests in the test/ directory will be run.
API Testing with Postman
This project includes an auto-generated Postman collection for all API endpoints:
# Generate/update the Postman collection
pnpm run generate:postmanThis creates b3-api.postman_collection.json with all service endpoints organized by route.
Quick Start:
- Run
pnpm run generate:postman - Import
b3-api.postman_collection.jsoninto Postman - Set
jwt_tokenvariable (copyb3-authcookie from global.b3.fun) - Start testing!
📚 See README_POSTMAN.md for detailed documentation.
Scaffolding
This app comes with a powerful command line interface for Feathers. Here are a few things it can do:
$ npx feathers help # Show all commands
$ npx feathers generate service # Generate a new ServiceCreate a new Service
Use the Feathers CLI via pnpm:
pnpm dlx @feathersjs/cli generate serviceMongoDB Extended Service Best Practices
This project uses a custom MongoDBExtendedService that extends the standard Feathers MongoDB service with additional type safety and functionality.
Type-Safe Collection Access
When working with MongoDB collections in service methods, always use await this.db() instead of await this.getModel(params) for better type safety:
// ✅ Recommended - Provides full type safety
const collection = await this.db();
// ❌ Avoid - Generic collection without proper typing
const collection = await this.getModel(params);The db() method returns a properly typed Collection<YourType & { _id: ObjectId }> which provides:
- Better TypeScript autocomplete and IntelliSense
- Compile-time type checking for document fields
- Enhanced refactoring support
- Prevention of runtime errors from typos
Help
For more information on all the things you can do with Feathers visit docs.feathersjs.com.
