
2 min read
Meteor project structure
Get the latest version of this specification here: https://gist.github.com/d4755eb1b7a9d6b08515408ea6fd69bb
The Meteor project structure (MPS) is a proposal for a simple file and folder naming specification.
There are several basic distinctions when building a Meteor project structure. First there is a client, server and an imports folder. All folders have specific naming rules and differ in their structure.
Global restrictions are applied to all folders:
- Non-npm-package-import sources are always
index.jsfiles. - Every first-level subfolder contains an
index.jsfile. - A subfolder depth of three is the limit.
- Everything which is not defined in this guide must be according to the Meteor code style guide.
Important paradigms:
- Modularity is key when designing a structure.
- A module is a namespace reserved for an entity.
Requirements:
- UI: React
- Local state: Redux
- Remote state: Meteor publications
client
Restrictions:
- Component file names are PascalCase.
- Folder and module names are lower case.
- CSS files can be placed anywhere.
Folders and files:
actions/Redux methods to dispatch actions.core.jsApplication actions.[modules].jsModule actions.
core/App react components.main.jsClient startup.main.htmlContains the render target for the react-dom mount and static header tags.MainLayout.jsIs the main template of the app.[modules]/Module react components.reducers/Redux state reducers.[state].jsFilename is equal to the state name.
users/User react components.
React component naming:
[Entity].jsSingle entity react component.[Entity]List.jsReact list view component.[Entity]Search.jsReact search form component.[Entity][Suffix]Container.jsReact component container.
imports
Folders and files:
collections/Mongo collections.[Modules].jsCollection definitions.
schemas/Schemas.[Module].jsSchema definitions.
helpers/Helper functions for client and server.translations/Translation sets.[language].jsContains a translated language set.
server
Server restrictions:
- Folder and module names are lower case.
Folders and files:
actions/Server only methods.[modules].jsModule specific actions.
methods/Meteor methods.[modules].jsModule Meteor methods.
pubication/sMeteor publications.[modules].jsModule Meteor publications.
main.jsServer startup.seeds.jsContains database seed sets.accounts.jsUser account configurations.
Publications and methods naming:
Component -> PublicationPostList -> posts.listPost -> posts.item
Action -> MethodUpdate post -> posts.updateRemove post -> posts.removeInsert post -> posts.insert
Tags: meteor , project , proposal , specification
Edit this page
Show statistic for this page