- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-08-2025 09:54 AM
I'm currently building my first application and I'm somewhat of an organization freak so I'm trying to not overthink this. It's been a long time since I've developed outside of ServiceNow IU so I'm a bit rusty on the best practices. I'd like to structure my project in a way where files are grouped by the context that they relate to but are separated by Type. So Table related components would be on file, Business Rules in another, Client Script in another, and so on. Does this make sense? Here's an example of the schema I was thinking of:
src/
- generated/
- ...
- exampleTableName/
- table.now.ts
- businessrules.now.ts
- clientscripts.now.ts
- ...
- server/
- ...
Let me know if this is a realistic path for building out applications for Fluent.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-08-2025 10:24 AM
Hey DJ,
You're directory structure is pretty close to the recommended one. Only comment would be that the SDK has separate now.config.json properties for server modules (serverModulesDir) and for .now.ts files (fluentDir). So generally we would recommend something like:
src/
- fluent
- generated/
- ...
- exampleTableName/
- table.now.ts
- businessrules.now.ts
- clientscripts.now.ts
- ...
- server/
- ...
These properties are configurable, but generally we would recommend a separation between `.now.ts` files and you're modular JS server code that is imported into any metadata in `.now.ts`. So in this case fluentDir would be the default value `src/fluent` and serverModulesDir would be the default `src/server`
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-08-2025 10:24 AM
Hey DJ,
You're directory structure is pretty close to the recommended one. Only comment would be that the SDK has separate now.config.json properties for server modules (serverModulesDir) and for .now.ts files (fluentDir). So generally we would recommend something like:
src/
- fluent
- generated/
- ...
- exampleTableName/
- table.now.ts
- businessrules.now.ts
- clientscripts.now.ts
- ...
- server/
- ...
These properties are configurable, but generally we would recommend a separation between `.now.ts` files and you're modular JS server code that is imported into any metadata in `.now.ts`. So in this case fluentDir would be the default value `src/fluent` and serverModulesDir would be the default `src/server`
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-08-2025 10:39 AM
Nice catch, thanks. Aside from the missing /fluent/, do you see any other rooms for improvement?