menu
announcement

Spectrum is now read-only. Learn more about the decision in our official announcement.

infrastructure

Infrastructure-Components let you configure your React App Infrastructure easily

Channels
Team

AWS Cognito, Email, SMS services?

December 11, 2019 at 12:10pm

AWS Cognito, Email, SMS services?

December 11, 2019 at 12:10pm
Hello everyone.. Infrastructure Components looks very promising, I plan to use this in my react app, but before I do that, I would like to know if I can use AWS services like Cognito, Email & SMS in my application? I ask this because, I saw that Infrastructure Components provide DataLayer for accessing DynamoDB, but didn't see anything related to these services? Another question: I am plan to have around 8-10 web services, which would be part of the Service-Component..wouldn't this be a huge code (i mean the definition of each service), is it possible to just declare a service in the service-component and define it in a separate file?

December 12, 2019 at 10:26am
Hello, Currently, Infrastructure-Components support
  • Services (API Gateway/Lambda)
  • DataLayer (DynamoDB)
  • FileStorage (S3)
  • Authentication (but not with Cognito)
Email support is planned for, but not yet ready.
But the service not being implemented with infrastructure-components (yet) does not mean you cannot use it. You would "only" have to implement the configuration yourself. But I'd be happy to support you here.
The number of services is not limited. Whatever the limit of AWS is for a certain CloudFormation-stack. If there is one at all. But 8-10 will be no problem.
I usually put each service into a separate file. Together with all the helper-functions.
Something like:
export default function MyService () {
return <Service
id={ MY\_SERVICE\_ID }
path="/mailing"
method="GET">
<Middleware
callback={serviceWithDataLayer(async function (dataLayer, req, res, next) { ... } />
</Service>
Your main index.tsx would then look like this:
import MyService from './my-service';
export default (
<IsomorphicApp
stackName = "react-architect"
buildPath = 'build'
assetsPath = 'assets'
region='eu-west-1'
>
<Environment name="dev" />
<DataLayer id="datalayer">
<MyService />
<WebApp
id="main"
path="*"
method="GET">
<HomePageRoute />
</WebApp>
</DataLayer>
</IsomorphicApp>);
You don't need a lot of boilerplate code for a service.
Let me know if you need anything
Edited

December 13, 2019 at 9:07am
sounds great I'll give it a shot and let you know if any queries. Thank you!